[rspec-users] Learning Cucumber
James B. Byrne
byrnejb at harte-lyne.ca
Thu Nov 13 11:51:27 EST 2008
Here is the scenario:
Scenario: Create a new entity row
Given I am on the new entity page
When I fill in a textbox labelled "Common Name" with "My New Entity"
And I fill in a textbox labelled "Full Legal Name:" with "My New
Enitity is a CORP"
And I select from a listbox labelled "Legal Form:" the value "CORP"
And I press "Create"
Then I should see "Entity was successfully created."
Now, the suggestions that cucumber makes about missing step definitions
are very useful, but I am not yet at the point where I understand enough
of this to proceed. For the moment I need to sort out the relationship of
cucumber with webrat.
In the case above, what I see when I run rake features is this:
Scenario: Create a new entity row # features/manage_entities.feature:7
Given I am on the new entity page # features/steps/entity_steps.rb:1
When I fill in a textbox labelled \
"Common Name" with "My New Entity" # features/steps/entity_steps.rb:5
And I fill in a textbox labelled \
"Full Legal Name:" with "My New Enitity is a CORP" \
And I select from a listbox labelled \
"Legal Form:" the value "CORP" # features/steps/entity_steps.rb:11
And I press "Create" # features/steps/common_webrat.rb:4
Then I should see \
"Entity was successfully created." # features/steps/common_webrat.rb:36
expected: /Entity was successfully created./m,
got: "<!-- application.html.erb -->\r\n<!DOCTYPE html PUBLIC \
So, evidently I need some other specification to check the validity of the
action with respect to the web page displayed. Can some one give me a
hint as to what "I should see "X" should actually say? Should this be a
regex? In other worlds should the outcome be specified as:
Then I should see "*Entity was successfully created*"
Unfortunately, I have many, many more questions, but I will try to feed
them in slowly.
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3
More information about the rspec-users