2014-12-02 3 views
-1

나는 아직 비교적 새로운 레일입니다. 현재 단계에서 붙어 :레일 오이 시나리오

And I should see "THX-1138" 

놀랍게도 지나쳤습니다. 그러나 나는 행복한 길의 마지막 단계에 머물러있다. 다음은 내 오류의 설명입니다 : 내 paths.rb에서

Then I should be on the Similar Movies page for "Star Wars" # features/step_definitions/web_steps.rb:230 
And I should see "THX-1138" # features/Search_movie_by_director.feature:25 

Ambiguous match of "I should see "THX-1138"": 
    features/step_definitions/movie_steps.rb:12:in `/^(?:|I)should see "([^"]*)"$/' 
    features/step_definitions/web_steps.rb:105:in `/^(?:|I)should see "([^"]*)"$/' 

    You can run again with --guess to make Cucumber be more smart about it 
    (Cucumber::Ambiguous) 
    features/Search_movie_by_director.feature:25:in `And I should see "THX-1138"' 

는 I했습니다 입력 : 내 영화 단계에서

When /the Similar Movies page for "(.*)"/ 

    "/movies/the_same_director/xxx%20XXX" 

(이 관련 의심) 나는했습니다 입력 :

Then /^(?:|I)should see "([^"]*)"$/ do |title| 
    if page.respond_to? :should 
     page.should have_content(title) 
    else 
     assert page.has_content?(title) 
    end 
end 

그리고 마지막으로 내 movie_controller.rb에서 :

def the_same_director 
    #left it empty for I think its relevant to the happy scenerio 
end 

누군가 올바른 방향으로 나를 가리 키길 바랍니다.

답변

1

모호한 단계 이름이 있습니다. 은 단계의 시작 부분에 Given, When, AndThen을 일반적인 자리 표시 자로 취급합니다. 그래서 :

And I should see " " 

Then I should see " " 

정말 같은 단계이다 이러한 경우

(Cucumber 관계없이의 step_function 폴더의 모든 파일을 볼 수는 파일을 호출 기능) 정확히 동일한 작업을 수행하여 기능 파일에서 단계가 동일하게 작성됩니다 (두 항목 모두를 다음과 같이 전환하십시오 :

Then I should see " " 

다음 단계 정의를 분해하십시오 (general_steps.rb 파일에 넣으십시오).

동작이 다른 경우 모호하지 않도록 단계 이름을 변경하십시오. 예를 들면 : 당신이 오이를 사용 오이 --guess을 시작할 때

Then I should see the movie title " " 

Then I should see the web site " " 

그렇지 않으면, 당신은 단지의 --guess 태그로 호출 할 수 있습니다. 이것은 작동해야하지만 여전히 모호성을 수정해야합니다.

+0

의견을 보내 주신 카일에게 감사드립니다. – user3435842

관련 문제