Ruby on rails 3 找不到链接(Capybara::ElementNotFound)

Ruby on rails 3 找不到链接(Capybara::ElementNotFound),ruby-on-rails-3,cucumber,saas,Ruby On Rails 3,Cucumber,Saas,我有问题: 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 "([^"]*

我有问题:

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)
在controller.rb中:

def find_movies_with_same_director
  # some code
end

怎么了?

谢谢Sevensacat的提示:保存并打开页面

我有一个设想:

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))

当您点击此链接时,您是否在正确的页面上?
code
场景:查找同一导演的电影鉴于我在《星球大战》的详细信息页面上,当我点击“查找同一导演的电影”
code
时没有回答问题。在失败步骤之前使用
save_和\u open_page
,确保您在正确的页面上。是的,您是对的。保存和打开页面-打开索引页面,但我不明白为什么?