我正在为涉及选中/取消选中框的场景编写步骤定义。在步骤定义中,我尝试使用 web_steps.rb 中的现有步骤。但是我收到错误:未定义的步骤:“我检查'评级'”。我需要做些什么来让 myfeature_steps.rb 了解 web_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