[rspec-users] More Examples

James Byrne lists at ruby-forum.com
Mon Nov 17 16:22:28 EST 2008

Matt Wynne wrote:
> On 17 Nov 2008, at 20:33, James B. Byrne wrote:
>>  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[1], you have to put a
> column in your More Examples table for every capture group in the
> regular expressions in your matchers.

I took out the check for the success confirmation to simplify things.

I added columns for the field and the action.

The remaining matcher is in webrat_steps:

Then /^I should see "(.*)"$/ do |text|
  response.body.should =~ /#{text}/m

This is what I see in the console:

  Scenario: The entity common name should be normalized 
# features/manage_entities.feature:41
    Given 1 valid entity 
# features/step_definitions/entity_steps.rb:25
    And I am on the edit entity page 
# features/step_definitions/entity_steps.rb:54
    When I fill in "Common Name" with "  ANYThing   WronG wITh tHiS? " 
# features/step_definitions/webrat_steps.rb:12
    And I press "Update" 
# features/step_definitions/webrat_steps.rb:4
    Then I should see "Anything Wrong With This?" 
# features/step_definitions/webrat_steps.rb:36

    |field        |input                        |action  |display 
    |"Common Name"|"ALL CAPS"                   |"Update"|"All Caps" 
`print_row': You have a nil object when you didn't expect it! 

do I misunderstand what you tried to tell me?
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list