0
我已经定义了这一步:暧昧一步
Then /^the "([^"]*)" field(?: within (.*))? should be empty$/ do |field, parent|
with_scope(parent) do
field = find_field(field)
field_value = (field.tag_name == 'textarea') ? field.text : field.value
if field_value.respond_to? :should
field_value.to_s.should == ''
else
assert_equal('', field_value.to_s)
end
end
end
,当我跑我的情况也引发以下错误:
那么“城市”领域的“买房子”的形式内应该是买房子的‘内场“‘’城市的空#暧昧匹配’的形式应该是空”:
features/step_definitions/my_steps.rb:1:in `/^the "([^"]*)" field(?: within (.*))? should be empty$/'
features/step_definitions/web_steps.rb:35:in `/^(.*) within (.*[^:])$/'
中提到的步骤是如下:
When /^(.*) within (.*[^:])$/ do |step, parent|
with_scope(parent) { When step }
end
所以,我有很多问题...
怎么能可能定义我的步骤,无需匹配?
When /^(.*) within (.*[^:])$/
似乎绝对是不可避免的。然而,这一步不会引起歧义:
features/step_definitions/web_steps.rb:141
Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
with_scope(parent) do
field = find_field(field)
field_value = (field.tag_name == 'textarea') ? field.text : field.value
if field_value.respond_to? :should
field_value.should =~ /#{value}/
else
assert_match(/#{value}/, field_value)
end
end
end
- 我不能只是删除
When /^(.*) within (.*[^:])$/
一步?它是“系统”的一部分吗?我的意思是,它是/step_definitions/web_steps.rb
,它配备了rake cucumber:install
。
谢谢。我不知道我是如何错过这个的:/ –