[rspec-users] More Examples

Pau Cor lists at ruby-forum.com
Tue Nov 18 01:25:47 EST 2008

James Byrne wrote:
> This is what I see in the console:
The underlining didn't come through in you post, so that doesn't help 

If you post your step matchers, then we can tell you what your columns 
need to be. Essentially, for every (.*) in your step matchers, you need 
a column. And they have to be in the order they are in the story.

Here is an example:

  Scenario: The entity common name should be normalized
    Given 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 "Anything Wrong With This?"

  More Examples:
    | page                 | field       | initial 
| Button | after                    |
    | the edit entity page | Common Name | "ALL CAPS" 
| Update | "All Caps"               |
    | the edit entity page | Common Name | "   Squeeze leading space" 
| Update | "Squeeze Leading Space"  |
    | the edit entity page | Common Name | "  Compact  Internal   space" 
| Update | "Compact Internal Space" |

Given /^I am on the "(.*)"$/ do |page|
When /^I fill in "(.*)" with "(.*)"$/ do |field, value|
When /^I press "(.*)"$/ do |button|
Then /^I should see "(.*)"$/ do |text|

You also need to be careful about ". I'm not sure if the way you are 
using those will include " in the string.

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

More information about the rspec-users mailing list