Forum: RSpec Cucmber Step to insert Test Data into Database

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Smita S. (Guest)
on 2009-05-27 13:20
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 "removed_email_address@domain.invalid"
  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.
David C. (Guest)
on 2009-05-27 13:27
(Received via mailing list)
On Wed, May 27, 2009 at 5:20 AM, Smita S. <removed_email_address@domain.invalid>
wrote:
>
>  And I fill in "Second Name" with "Martin"
>  And I fill in "Zip Code" with "sk8 4ty"
> 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

Cheers,
David
Scott T. (Guest)
on 2009-05-27 17:55
(Received via mailing list)
David C. wrote:
>>
>>  When I follow "New User"
>>  And I fill in "County" with "Cheshire"
>> end
>
> 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
Lee H. (Guest)
on 2009-05-27 18:17
(Received via mailing list)
Scott, Last mondayish ?
- Lee

2009/5/27 Scott T. <removed_email_address@domain.invalid>
Ben M. (Guest)
on 2009-05-27 18:19
(Received via mailing list)
Scott T. wrote:
>>> But while running the cucumber features, all the scenario and steps are
>>> Scenario: Create User
>>>  And I fill in "Address Line 1" with "58"
>>>
>>> gets inserted into the database.
> When was the decision made to split off the cucumber group?
>
> Scott

http://rubyforge.org/pipermail/rspec-users/2009-Ma...

-Ben
This topic is locked and can not be replied to.