Closed dmvt closed 6 years ago
Another potential solution to this would be to check for nil in the url at the breadcrumb creation time and present an error. If you'd like me to redo this using that approach, I'm happy to.
Hi Dan,
Thanks for using the library!
I don't fully agree with your reasoning. If I understand correctly, you have an issue running your tests as one of the crumbs has nil value for url param. I don't believe this library should be checking for such cases. Firstly, creating or having breadcrumbs with nil links is an application level erroneous condition and that's where I believe it should be fixed. What if a breadcrumb is created without any name, should the library check for that as well? Most importantly, your solution decides that nil value should be substituted for some other string value which may lead to other bugs. Having said that, I would be happy to raise an error during crumb initialization to ensure consistent data.
When running tests with RSpec & Capybara we (Punchpass) were encountering the following error:
After a bit of digging, I found the cause to be a nil value in the url for our last breadcrumb. Interestingly, the error didn't trip in development or production, just testing. Adding the nil check allowed our tests to pass gracefully.