我有问题:
When I follow "Find Movies With Same Director" #
features/step_definitions/web_steps.rb:56
Unable to find link "Find Movies With Same Director" (Capybara::ElementNotFound)
web_steps.rb中的:
When /^(?:|I )follow "([^"]*)"$/ do |link|
click_link(link)
end
在我的路线中:
find_movies_with_same_director_movie GET /movies/:id/find_movies_with_same_director(.:format) {:action=>"find_movies_with_same_director", :controller=>"movies"}
movies GET /movies(.:format)
在我看来show.html.haml:
%br
= link_to 'Find Movies With Same Director', find_movies_with_same_director_movie_path(@movie)
控制器movies_controller.rb中的:
def find_movies_with_same_director
# some code
end
有什么不对?
答案 0 :(得分:0)
感谢sevenseacat提示:save_and_open_page
我有场景:
Scenario: find movie with same director
Given I am on the details page for "Star Wars"
When I follow "Find Movies With Same Director"
步骤:鉴于我在“星球大战”的详细信息页面上 我错了:
when /^the details page for "(.*)"$/
movies_path(Movie.find_by_title($1))
正确的道路:
when /^the details page for "(.*)"$/
movie_path(Movie.find_by_title($1))