我有一个这样的功能文件
Feature: search for movies by director
As a movie buff
So that I can find movies with my favorite director
I want to include and serach on director information in movies I enter
Background: movies in database
Given the following movies exist:
| title | rating | director | release_date |
| Star Wars | PG | George Lucas | 1977-05-25 |
| Blade Runner | PG | Ridley Scott | 1982-06-25 |
| Alien | R | | 1979-05-25 |
| THX-1138 | R | George Lucas | 1971-03-11 |
Scenario: add director to existing movie
When I go to the edit page for "Alien"
And I fill in "Director" with "Ridley Scott"
And I press "Update Movie Info"
Then the director of "Alien" should be "Ridley Scott"
现在我有一个像这样的步骤定义,它通过给定以下电影存在:案例。
Given /the following movies exist/ do |movies_table|
movies_table.hashes.each do |movie|
Movie.create!(movie)
end
结尾
但是当黄瓜运行步骤时,当我进入“Alien”的编辑页面时,它会抛出这个错误
没有路线匹配 {:action=>"edit", :controller=>"movies"}
(ActionController::RoutingError) ./features/support/paths.rb:20:in `path_to'
我的 paths.rb 在 path_to 中有这个案例
when /^the edit page for (.*)/
m = Movie.find_by_title($1)
edit_movie_path(m)
我检查了 m 是否为零,但在后台我将四部电影添加到数据库中。我还检查了“耙路线”,但所有路线都存在。
请帮助我理解,我对铁轨和黄瓜很陌生。谢谢