I have a test in my functional test which asserts the redirect after a remove is correct:
assert_redirected_to terrain_tip_url(terrain_id: entities(:deroos))
This should result in testing whether the url is: http://test.host/terrains/:terrain_id/tips and in the application that is the exact url that is generated. However, in the test case this results in the url being: http://test.host/terrains/:terrain_id/tips/:id, which results in a failing test case:
Expected response to be a redirect to <http://test.host/terrains/446801721/tips/495319887> but was a redirect to <http://test.host/terrains/446801721/tips>
Why does the terrain_tip_url include an id parameter that I never set? How can I prevent this from happening?
Running
rake routesshould give you some insight here. I believe what you want isterrain_tips_url(index), notterrain_tip_url(show).http://guides.rubyonrails.org/routing.html#crud-verbs-and-actions