2011-12-23 8 views
3

오이와 BDD에 익숙해 지려고 노력 중입니다. 몇 가지 기능을 이미 작성했는데, 특히 혼란 스럽습니다. 여기에 오류 :Cucumber와 함께이 오류를 알아낼 수 없습니다. "매핑을 찾을 수 없습니다."

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 

그것은까지 통과 년대 "그럼 난 후 페이지 ...에 있어야합니다"

사람이 함께 무슨 일이 일어나고 있는지 제안 할 수 있습니까?

감사

J는

+0

path.rb에서 무엇을해야합니까? – Aravin

+0

@Aravin 아무것도, 그냥 그대로 둘 수 있어야합니다. 문제가 있습니까? – JeffC

답변

4

당신이 이동해야 할 수도 있습니다 paths.rb

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

에 경로 매핑을 찾을 것으로 예상합니다. 우연히 다른 테스트에이 같은 문제가 있습니까? 아니면 이미 가지고있는 것과 함께 작동합니까?

+1

OMG, 소음 때문에 죄송합니다, 감사합니다. 그것이 바로 그 것이었다. – JeffC

+1

걱정할 필요가 없습니다. 오이는 당신이해야 할 모든 것을 말해 주려고합니다. 그러나 그것에 익숙하지 않았을 때 저에게 말해 주려고했던 절반을 보지 못했습니다. – jefflunt

관련 문제