【发布时间】:2012-03-30 18:00:43
【问题描述】:
我有一个黄瓜步骤定义,它没有在对象上拾取。
错误是:
| title | description |
| First Issue | This is a first issue. |
undefined method `issues' for nil:NilClass (NoMethodError)
./features/step_definitions/issue_steps.rb:3:in `block (2 levels) in <top (required)>'
特点:
Background:
Given there is a release called "First Release"
And that release has a feature:
| title | description |
| Make it shiny! | Gradients! Starbursts! Oh my! |
And that feature has a issue:
| title | description |
| First Issue | This is a first issue. |
And I am on the homepage
路线:
resources :releases do
resources :features
end
resources :features do
resources :issues
end
步骤定义:
Given /^that feature has a issue:$/ do |table|
table.hashes.each do |attributes|
@feature.issues.create!(attributes)
end
end
步骤定义:特征
Given /^that release has a feature:$/ do |table|
table.hashes.each do |attributes|
@release.features.create!(attributes)
end
end
【问题讨论】:
-
请发布
And that release has a feature:的步骤定义 -
我已经完成了,如果您还需要什么,请告诉我。