2011-03-09 3 views
2

오이 내 단계와 경로를 단순화하기 위해 피클 (레일 3)을 살펴보고 있습니다. 경로 수정을 위해 path_to_pickle을 사용하는 데 문제가 있습니다. 오이 피클의 path_to_pickle 사용법

내가 함께 피클을 설치 :

when /^#{capture_model}(?:'s)? page$/       # eg. the forum's page 
    path_to_pickle $1 

when /^#{capture_model}(?:'s)? #{capture_model}(?:'s)? page$/ # eg. the forum's post's page 
    path_to_pickle $1, $2 

when /^#{capture_model}(?:'s)? #{capture_model}'s (.+?) page$/ # eg. the forum's post's comments page 
    path_to_pickle $1, $2, :extra => $3       # or the forum's post's edit page 

when /^#{capture_model}(?:'s)? (.+?) page$/      # eg. the forum's posts page 
    path_to_pickle $1, :extra => $2        # or the forum's edit page 

: 나는 피클가 생성하는 표준 경로를 사용하고

Scenario: Edit a ledger 
    Given I have a ledger with name "Digitech" 
    When I go to the ledger's edit page 
    And I fill in "Name" with "Test Ledger" 
    And I press "Update Ledger" 
    Then I should be on the ledgers page 
    And I should see "Ledger was successfully updated." 

:

rails g pickle --paths --email 

전 원장을 편집하기위한 시나리오를 오이를 실행하려고하면이 오류가 발생합니다.

When I go to the ledger's edit page     # features/step_definitions/web_steps.rb:19 
    Could not figure out a path for ["the ledger"] {:extra=>"edit"} (RuntimeError) 
    ./features/support/paths.rb:32:in `path_to' 
    ./features/step_definitions/web_steps.rb:20:in `/^(?:|I)go to (.+)$/' 
    features/ledger/manage_ledgers.feature:61:in `When I go to the ledger's edit page' 

나는 path_to_pickle이주의를 기울여야한다는 메일 링리스트를 읽었지만 9 월에 돌아왔다. 아직도 그렇습니까?

polymorphic_path (model ($ 1)) 같은 것을 사용해야합니까?

답변

1

나는 path_to_pickle을 포기하고 다형성 경로를 사용했다. 이것은 편집 페이지 캡처를 위해 작성한 단계입니다. 당신은

when /^the edit page for #{capture_model}$/ 
    polymorphic_path(model!($1), :action => "edit") 
+0

는 시도보다 일반적인 솔루션을 '수정'을 대체 할 수있는 그 때 라인 : '나는 "메인"원장에 대한 편집 페이지로 이동'내가 오류 얻을 '모델을'원장 "Main" '은이 시나리오에서는 알 수 없습니다.'. polymorphic_path는 어떤 장부를 편집해야하는지 어떻게 알 수 있습니까? 아니면 path 명령에 맞게 when 문을 어떻게 작성해야합니까? – map7

+0

피클의 모델을 사용 중일 때! 방법을 사용하려면 먼저 pickle 단계를 사용하여 원하는 모델의 인스턴스를 식별해야합니다. 문자열 "ledger"를 입력으로 사용하므로 참조가 사용되기 전에 참조되는 값을 설정해야합니다. "나는 장부가 있습니다 ..."를 사용하는 대신 "장부가 존재합니다 ..."를 사용해야합니다. 현재 구문을 유지하려면 피클 데이터를 설정하려면 "원장이 있어야합니다 ..."줄을 추가하십시오. – jeremiahishere