Created
March 28, 2012 09:14
-
-
Save relaxdiego/2224979 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Create a User | |
Background: | |
* Clarice is a system administrator | |
* Dave is an ordinary user | |
Scenario Outline: | |
Given <User> is logged in | |
When she tries to create a user | |
Then the new user will <Be Created or Not> | |
Examples | |
| User | Be Created or Not | | |
| Clarice | be created | | |
| Paul | not be created | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given /^(.+) is logged in$/ do |user| | |
steps %{ | |
* visit '/' | |
* fill in username with username of #{user} | |
* fill in password with password of #{user} | |
* click on login | |
} | |
end | |
When /^(?:he|she) tries to create a user$/ do | |
steps %{ | |
* visit '/users' | |
* fill in name with Albert | |
* fill in email with [email protected] | |
* fill in password thisismypassword | |
* fill in password confirmation with thisismypassword | |
* click on save | |
} | |
end | |
Then /^the new user will be created$/ do | |
steps %{ | |
* click on logout | |
* visit '/' | |
* fill in email with [email protected] | |
* fill in password with thisismypassword | |
* click on login | |
* current path should be '/welcome' | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^visit (.+) page$/ do |page| | |
visit page | |
end | |
When /^fill in (.+) with (\S+)$/ do |element_id, value| | |
page.should have_selector("\##{field_id}") | |
fill_in element_id, :with => value | |
end | |
When /^fill in (.+) with (\S+) of (\S+)$/ do |element_id, attribute, username| | |
page.should have_selector("\##{field_id}") | |
fill_in element_id, :with => @users[username][attribute] | |
end | |
When /^click on (.+)$/ do |element_id| | |
page.should have_selector("\##{element_id}") | |
click on element_id, :with => value | |
end | |
Then /^current path should be '(.+)'$/ do |path| | |
current_path.should == path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment