Skip to content

Instantly share code, notes, and snippets.

@webdevotion
Created February 10, 2012 12:31
Show Gist options
  • Save webdevotion/1789366 to your computer and use it in GitHub Desktop.
Save webdevotion/1789366 to your computer and use it in GitHub Desktop.
Feature: Creating Users
In order to add new users to the system
As an admin
I want to be able to add them through the backend
Background: # features/creating_users.feature:6
Given there are the following users: # features/step_definitions/user_steps.rb:1
| email | password | admin |
| [email protected] | password | true |
And I am signed in as them # features/step_definitions/user_steps.rb:10
Given I am on the homepage # features/step_definitions/web_steps.rb:23
When I follow "Admin" # features/step_definitions/web_steps.rb:35
And I follow "Users" # features/step_definitions/web_steps.rb:35
When I follow "New User" # features/step_definitions/web_steps.rb:35
Scenario: Creating a new user # features/creating_users.feature:16
And I fill in "Email" with "[email protected]" # features/step_definitions/web_steps.rb:39
And I fill in "Password" with "password" # features/step_definitions/web_steps.rb:39
And I press "Create User" # features/step_definitions/web_steps.rb:31
Then I should see "User has been created." # features/step_definitions/web_steps.rb:84
Scenario: Leaving email blank results in an error # features/creating_users.feature:22
When I fill in "Email" with "" # features/step_definitions/web_steps.rb:39
And I fill in "Password" with "password" # features/step_definitions/web_steps.rb:39
And I press "Create User" # features/step_definitions/web_steps.rb:31
Then I should see "User has not been created." # features/step_definitions/web_steps.rb:84
And I should see "Email can't be blank" # features/step_definitions/web_steps.rb:84
expected there to be content "Email can't be blank" in "\n Ticketee\n \n\n Ticketee\n Admin\n Your Profile\n Sign Out\n\n \n User has not been created.\n \n New User\n\n\n \n \n Email\n \n \n \n Password\n \n \n \n \n\n \n © Ticketee 2012 - Development by Bram Plessers - Built with Ruby On Rails\n " (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:86:in `/^(?:|I )should see "([^"]*)"$/'
features/creating_users.feature:27:in `And I should see "Email can't be blank"'
Failing Scenarios:
cucumber features/creating_users.feature:22 # Scenario: Leaving email blank results in an error
2 scenarios (1 failed, 1 passed)
21 steps (1 failed, 20 passed)
0m0.604s
Then /^(?:|I )should see "([^"]*)"$/ do |text|
if page.respond_to? :should
page.should have_content(text)
else
assert page.has_content?(text)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment