[rspec-users] More Examples
matt at mattwynne.net
Mon Nov 17 15:49:26 EST 2008
On 17 Nov 2008, at 20:33, James B. Byrne wrote:
> I have a feature spec that looks like this:
> Scenario: The entity common name should be normalized
> Given 1 valid entity
> And I am on the edit entity page
> When I fill in "Common Name" with " ANYThing WronG wITh tHiS? "
> And I press "Update"
> Then I should see an update success confirmation
> And I should see "Anything Wrong With This?"
> More Examples:
> | initial | after |
> | "ALL CAPS" | "All Caps" |
> | " Squeeze leading space" | "Squeeze Leading Space" |
> | " Compact Internal space" | "Compact Internal Space" |
> The first bit passes but for the life of me I cannot figure out what
> I am
> supposed to do to get the More Examples to work.
You're probably not specifying all the variables you need to.
Until we get the Scenario Outlines feature, you have to put a
column in your More Examples table for every capture group in the
regular expressions in your matchers.
The way I usually do this is look at the output in the console from
Cucumber and see where the bits are underlined, and make a column for
each of them.
That can feel a bit silly when most of them don't vary during your
extra examples, but that's why we need the Scenario Outline feature.
For the time being it's still great that we can do this at all.
More information about the rspec-users