2

我有问题:

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

怎么了?

4

1 回答 1

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))
于 2013-02-21T21:25:59.947 回答