मैं रेल रूस पर रूबी में बीडीडी विकास के लिए ककड़ी का उपयोग कर रहा हूं और मैं कुछ भ्रम में भाग रहा हूं कि पथ.आरबी रेल अनुप्रयोगों में उपयोग किए जाने वाले पथों को कैसे नियंत्रित करता है।ककड़ी और webrat - paths.rb में गतिशील यूआरएल कैसे संभालें?
को देखते हुए मेरे पास है:
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 ==)
मुझे वास्तव में परवाह नहीं है कि आईडी क्या है। इसके बजाय मुझे क्या करना चाहिए? क्या यह डिफ़ॉल्ट वेब चरणों के साथ भी संभव है? क्या मैं गलत तरीके से समस्या के बारे में सोच रहा हूं?