我想要習慣與黃瓜的BDD和我寫了一些功能已經但這一個特別我困惑,這裏是錯誤:無法找出這個錯誤與黃瓜「無法找到映射」
Scenario: # features/viewing_posts.feature:6
Given there is a post with the title "Just another day at the beach" # features/step_definitions/post_steps.rb:1
And I am on the homepage # features/step_definitions/web_steps.rb:44
When I follow "Just another day at the beach" # features/step_definitions/web_steps.rb:56
Then I should be on the post page for "Just another day at the beach" # features/step_definitions/web_steps.rb:230
Can't find mapping from "the post page for "Just another day at the beach"" to a path.
Now, go and add a mapping in /Users/jeff/rails_projects/jeffc/features/support/paths.rb (RuntimeError)
./features/support/paths.rb:29:in `rescue in path_to'
./features/support/paths.rb:23:in `path_to'
./features/step_definitions/web_steps.rb:233:in `/^(?:|I)should be on (.+)$/'
features/viewing_posts.feature:10:in `Then I should be on the post page for "Just another day at the beach"'
Failing Scenarios:
cucumber features/viewing_posts.feature:6 # Scenario:
我檢查了我的web_steps.rb在那個錯誤,我有步驟,應該匹配。
Then /^(?:|I)should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
if current_path.respond_to? :should
current_path.should == path_to(page_name)
else
assert_equal path_to(page_name), current_path
end
end
它向上傳遞,直到「那我應該是後頁...的」
任何人都可以提出這是怎麼回事這個?
感謝
Ĵ
我應該在path.rb中做些什麼? – Aravin 2015-10-19 09:24:34
@Aravin什麼也不要,應該能夠保持原樣。你有問題嗎? – JeffC 2015-10-26 02:38:23