Why won't this cucumber line parse?
I have the following simple cucumber step:
Given I submit "Father father father help us" in reply to "Where is the love?"
I also already have the cucumber step:
Given /^I submit "([^"]*)" in reply to "([^"]*)"$/ do |reply, question|
...
end
Each time I run it though, the question mark at the end sends the parser wobbly and I get back the following:
You can implement step definitions for undefined ste开发者_Python百科ps 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
Why isn't this parsing correctly and what can I do to correct it?
I put a quick test together, and here's what i have. It works fine, all tests pass:
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
What version of cucumber are you using? Here's what i have in my 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)
The suggested step definition above doesn't correspond to that Cucumber step. I suspect you have a near-identical step somewhere else in your feature files but without the quotes around "Where is the love?".
精彩评论