Ruby on Rails 프로젝트에서 BDD 개발을 위해 Cucumber를 사용하고 있으며 레일 애플리케이션에서 path.rb가 사용하는 경로를 처리하는 방법에 대해 혼란을 겪고 있습니다.Cucumber와 webrat - paths.rb에서 동적 URL을 처리하는 방법은 무엇입니까?
class Parent < ActiveRecord::Base
has_many :children
end
class Child < ActiveRecord::Base
belongs_to :parent
end
나는 다음 오이 기능이 있습니다 :
나는이 주어진 정의 된 경로
Scenario: A test feature
Given I am on the parent page
When I follow "Link to Children"
Then I should be on the children list page
:
def path_to(page_name)
case page_name
when /the children list page/
'/parents/:id/children'
end
내가 건너 문제는이다 기능을 실행할 때 다음 오류가 발생했습니다.
Spec::Expectations::ExpectationNotMetError: expected: "/parents/:id/children",
got: "/parents/1726/children" (using ==)
나는 정말로 : id가 무엇인지 신경 쓰지 않습니다. 대신 무엇을해야합니까? 기본 웹 단계에서도 가능합니까? 문제에 대해 잘못된 생각을하고 있습니까?