我有以下简单的黄瓜步骤:
Given I submit "Father father father help us" in reply to "Where is the love?"
我还有黄瓜步骤:
Given /^I submit "([^"]*)" in reply to "([^"]*)"$/ do |reply, question|
...
end
每次我运行它时,最后的问号会使解析器摇摇晃晃地返回以下内容:
You can implement step definitions for undefined steps with these snippets:
Given /^I submit "([^"]*)" in reply to Where is the love\?$/ do |arg1|
pending # express the regexp above with the code you wish you had
end
为什么这种解析不正确,我该怎么做才能纠正它?
答案 0 :(得分:2)
我把快速测试放在一起,这就是我所拥有的。它工作正常,所有测试都通过:
Feature: test
Scenario:
Given I submit "Father father father help us" in reply to "Where is the love?"
When I do this
Then I receive that
Given /^I submit "([^"]*)" in reply to "([^"]*)"$/ do |arg1, arg2|
true
end
When /^I do this$/ do
true
end
Then /^I receive that$/ do
true
end
你使用的黄瓜版本是什么?这是我在Gemfile.lock中的内容
cucumber (1.0.2)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.4.5)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
cucumber-rails (1.0.2)
capybara (>= 1.0.0)
cucumber (~> 1.0.0)
nokogiri (>= 1.4.6)
答案 1 :(得分:0)
上面建议的步骤定义与黄瓜步骤不对应。我怀疑你的功能文件中的其他地方有一个几乎相同的步骤,但没有“爱在哪里?”的引号。