2011-12-23 73 views
3

我想要習慣與黃瓜的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 

它向上傳遞,直到「那我應該是後頁...的」

任何人都可以提出這是怎麼回事這個?

感謝

Ĵ

+0

我應該在path.rb中做些什麼? – Aravin 2015-10-19 09:24:34

+0

@Aravin什麼也不要,應該能夠保持原樣。你有問題嗎? – JeffC 2015-10-26 02:38:23

回答

4

它希望找到在paths.rb

Now, go and add a mapping in /Users/jeff/rails_projects/jeffc/features/support/paths.rb (RuntimeError) 

路徑映射您可能需要移動它。你的其他測試是否偶然有這個相同的問題,或者他們是否與你已有的一樣工作?

+1

OMG,即時通訊對不起,感謝normalocity。這就是它。 – JeffC 2011-12-23 16:19:28

+1

不用擔心。黃瓜試圖告訴你你需要做的一切,但是當我剛接觸它時,我沒有看到它試圖告訴我的一半垃圾。 – jefflunt 2011-12-23 16:20:13