Reputation: 135
Capybara standard step with my debugger point:
When /^(?:|I )follow "([^"]*)"$/ do |link|
debugger
click_link(link)
end
In debugger console I look at page.body
and see this link:
<a href=\"/movies/find_all_by_director/George%20Lucas?movie_id=1\">Find Movies With Same Director</a>
But Cucumber test gives me an error:
When I follow "Find Movies With Same Director"
No route matches [GET] "/movies/find_all_by_director/George%20Lucas" (ActionController::RoutingError)
Where is my movie_id
parameter?
UPDATE: There may be a mistake. config/routes.rb
:
Rottenpotatoes::Application.routes.draw do
resources :movies
get 'movies/find_all_by_director/:director?movie_id=:movie_id' => 'movies#find_all_by_director', :as => 'find_all_by_director'
end
Upvotes: 0
Views: 572
Reputation: 4506
When you click this link in a browser does it come up with an routing error as well?
I don't think it's to do with capybara (click_link definitely does honor query params). It's just that Rails is answering that there's no route -- the query params don't generally influence routing so they are irrelevant to it.
see also: http://guides.rubyonrails.org/routing.html#the-query-string but note it might be possible for routing to be adjusted by segment constraints:
Upvotes: 1