[rspec-users] Cucumber Tables

James Byrne lists at ruby-forum.com
Wed May 13 10:07:54 EDT 2009

I am running into this situation:

Feature 1

  Scenario A
    Then we should have currency exchange rates for "USD" on file
      And we should ...

Feature 2

  Scenario D
    Then we should have currency exchange rates for "USD" on file
        | code|
      And we should not ...

This arrangement presently gives a cucumber error because the step
definition that matches will either have one argument too many or one
too few.  However, from a user point of view it strikes me that this
situation should not be an error at all.

My reasoning is this.  The features statement as given is completely
logical, straight-forward and applicable in either situation.  Having a
requirement to create separate invocations for exactly the same test,
depending only upon whether one wishes to do it once or several times,
strikes me as bending the situation to the limitations of the
implementation rather than elaborating the implementation to handle the

On the other hand, as this may be quite involved to solve I am not
saying what I suggest MUST be the behavior, only that it seems to me
that it should be.

I seem to recall that when I first used cucumber in December last, that
one could either provide additional examples to a matcher in a scenario
or not.  In either case the matcher would work.  I think that this
behaviour, if at all possible, might be more natural than requiring two
separate matchers that exist only to match to different patterns.

What do you all think?
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list