3
我正在为涉及检查/取消选中框的方案编写一个步骤定义。在步骤定义中,我试图使用web_steps.rb中的现有步骤。但是我收到错误:未定义的步骤:“我检查'评分'”。有什么我必须做我的myfeature_steps.rb意识到web_steps.rb。谢谢!黄瓜在我自己的步骤定义中重复使用web_steps.rb中的步骤myfeature_steps.rb
When /I (un)?check the following ratings: (.*)/ do |uncheck, rating_list|
ratings = rating_list.split(%r{,\s*})
if uncheck
ratings.each do |r|
step "I uncheck #{r}"
end
else
ratings.each do |r|
step "I check #{r}"
end
end
end
以下步骤定义在web_steps.rb存在
When /^(?:|I)check "([^"]*)"$/ do |field|
check(field)
end
When /^(?:|I)uncheck "([^"]*)"$/ do |field|
uncheck(field)
end
谢谢。这工作。我离开了我的步骤定义,但现在我在我的步骤中提供了用双引号括起来的元素 – user1493570 2012-08-11 20:57:40