Zack
Zack

Reputation: 2208

Ambiguous match while using cucumber step definitions

Need some help in getting rid of this error. Not able to pass this step with cucumber.

 And I fill in "Email" with "[email protected]"               # features/developer_registration.feature:9
      Ambiguous match of "I fill in "Email" with "[email protected]"":

      features/step_definitions/developer_steps.rb:9:in `/^I fill in "(.*?)" with "(.*?)"$/'
      features/step_definitions/developer_steps.rb:31:in `/^I fill in "(.*?)" with "(.*?)"$/'

THe part in steps.rb which deals with this step.

When(/^I fill in "(.*?)" with "(.*?)"$/) do |email, password|


  fill_in "[email protected]", with: email # express the regexp above with the code you wish you had
  fill_in "1", with: password

end

Upvotes: 0

Views: 1059

Answers (2)

Zack
Zack

Reputation: 2208

I modified the code as below and it worked as required.

When(/^I fill in Email with "(.*?)"$/) do |email|
  fill_in "EMAIL", with: email # express the regexp above with the code you wish you had
end

Upvotes: 0

Zach Dennis
Zach Dennis

Reputation: 1784

According to the output you have the same step defined. Once on line 9 and the other on line 31. You only showed one of those definitions.

Check the two definitions on those lines and you will likely find the source of your problem.

Upvotes: 1

Related Questions