2015-02-12 70 views
0

需要一些幫助來擺脫此錯誤。無法通過黃瓜這一步。使用黃瓜步驟定義時的模糊匹配

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 "(.*?)"$/' 

這部分在steps.rb處理這一步。

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 

回答

0

我修改了代碼,如下所示,它按要求工作。

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 
1

根據輸出結果,您可以定義相同的步驟。一旦在第9行,另一個在第31行。你只顯示了其中一個定義。

檢查這兩行的定義,你很可能會發現問題的根源。