[rspec-users] Cucumber - Ambiguous steps

Joseph Wilk
Mon, 15 Sep 2008 13:50:01 -0000

David Chelimsky wrote:
> On Mon, Sep 15, 2008 at 8:21 AM, David Chelimsky <dchelimsky at
gmail.com>
> wrote:
>>>>>> anyone have good examples where they would?
>>> you just stick a $ at the end of the Regexp?
>>>
>>> That''s how regexen work. I don''t see why they
should work any
>>> differently when used in Cucumber.
>>
>> My previous comments withdrawn. I agree with Aslak.
>
> Although, I can see why one might be confused by this. I was. Even
> though these are regular expressions, the context led me to an
> (erroneous, but intuitive) expectation that in the presence of these
> two ...
>
>   /this and "(.*)"/
>   /this and "(.*)" and the other thing/
>
> ... that the first would not match "this and that and the other
thing"
>
> Perhaps a hint in the error message is in order?
>
>     When this and "that" and the other thing
>       Ambiguous step resolution for "this and \"that\" and
the other
> thing":
>
>       ./features//foo-steps.rb:4:in `/this and "(.*)" and the
other
> thing/''
>       ./features//foo-steps.rb:1:in `/this and "(.*)"/''
> (Cucumber::Ambiguous)
>
>       Consider ending the shorter expression with a $
>
> WDYT?

I can see the logic of what you are both saying, so David''s
error/warning seems like the best idea. We can avoid other people
getting confused about this.

--
Joseph Wilk
http://www.joesniff.co.uk
--
Posted via http://www.ruby-forum.com/.