[rspec-users] what's wrong with my newbie cucumber test?

James Byrne lists at ruby-forum.com
Sun May 17 11:51:35 EDT 2009

Zhenning Guan wrote:

> when I run rake features.
> ==
> Scenario: List Tasks        # features/forums.feature:6
>     When I go to the homepage # features/forums.feature:7
>       Ambiguous match of "I go to the homepage":
>       features/step_definitions/webrat_steps.rb:10:in `/^I go to (.+)$/'
>       features/step_definitions/forums_steps.rb:1:in `/^I go to the
> homepage$/'
>       You can run again with --guess to make Cucumber be more smart
> about it
>        (Cucumber::Ambiguous)
> does anyone can tell me what's wrong with my test?

You have duplicate step matchers, one in webrat_steps.rb at line 10 and 
the other in forums_steps at line 1.  The regexp /^I go to (.+)$/ 
matches the same thing as /^I go to the homepage$/.  Change them so as 
to be more specific.

/^ I go to the forum (.+)$/


/^I go to the user homepage$/

Personally, I drop the leading pronoun together with the start/end of 
line symbols as well.

/\bgo to the user homepage\b/

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list