I have emailed before about the inconsistencies I’m spotting when using
named routes/resource, but I think I’ve narrowed down the issue. It
seem this has nothing to do with rspec per se, but more with how routing
works with rails.
If you have an object instance, that isn’t saved and you attempt to
a path for that item, even though the item may have an ID, you get a “No
route matches” exception.
If the item is saved, then a valid route can be generated for that item.
Two things seem odd:
- The exception raised isn’t very informative
- Why is this a constraint? And can it be turned off for testing
Is there a way around this? Or do I need to use rspec mock objects?