[rspec-users] Cucmber Step to insert Test Data into Database

Ben Mabey ben at benmabey.com
Wed May 27 10:06:46 EDT 2009


Scott Taylor wrote:
> David Chelimsky wrote:
>> On Wed, May 27, 2009 at 5:20 AM, Smita Sreekanth 
>> <lists at ruby-forum.com> wrote:
>>  
>>> Hi,
>>>
>>> We run the feature created for a form to identify the fields and 
>>> also to
>>> add data into the respective fields.
>>>
>>> But while running the cucumber features, all the scenario and steps are
>>> getting passed but the record is not getting inserted into the
>>> application / the database.
>>>
>>> We have also wrote the feature as:
>>>
>>> Feature: Adding a user
>>>  In order to add a user to the organization
>>>  As a administrator
>>>  I want to create and add new user
>>>
>>> Scenario: Create User
>>>  Given that I have no users
>>>  And I am on the "List of users"
>>>  When I follow "New User"
>>>  And I fill in "First Name" with "Rebecca"
>>>  And I fill in "Second Name" with "Martin"
>>>  And I fill in "Title" with "Miss"
>>>  And I fill in "Email" with "rebeccamartin at me.com"
>>>  And I fill in "Telephone" with "01617867645"
>>>  And I fill in "Mobile" with "01777867645"
>>>  And I fill in "Fax" with "01617867640Î"
>>>  And I fill in "Address Line 1" with "58"
>>>  And I fill in "Address Line 2" with "West Tree rd"
>>>  And I fill in "Address Line 3" with "Stockport"
>>>  And I fill in "County" with "Cheshire"
>>>  And I fill in "Country" with "United Kingdom"
>>>  And I fill in "Zip Code" with "sk8 4ty"
>>>  And I press "Create"
>>>  Then I should have 1 user
>>>
>>>
>>> And steps as:
>>>
>>> Then /^I should have ([0-9]+) user$/ do |c|
>>>  User.count.should==c.to_i
>>> end
>>>
>>> Given /^that I have no users$/ do
>>>  User.delete_all
>>> end
>>>
>>> If somebody could help us out, how to execute the steps so that the 
>>> data
>>> gets inserted into the database.
>>>
>>> Smita.
>>>     
>>
>> Hi Smita. Please use the new Cucumber google group for new threads
>> about Cucumber:
>>
>>   http://groups.google.com/group/cukes
>>   
>
> When was the decision made to split off the cucumber group?
>
> Scott

http://rubyforge.org/pipermail/rspec-users/2009-May/014502.html

-Ben


More information about the rspec-users mailing list