Skip to content

Instantly share code, notes, and snippets.

@CodeOfficer
Created November 11, 2009 00:32
Show Gist options
  • Save CodeOfficer/231442 to your computer and use it in GitHub Desktop.
Save CodeOfficer/231442 to your computer and use it in GitHub Desktop.
# Scenario Outline: Viewing <user_count> users
# Given I am a logged in admin
# And there are <user_count> users
# When I go to the admin users page
# Then I should see the users
# And I should not see "No users registered"
#
# Examples:
# | user_count |
# | 1 |
# | 2 |
# | 5 |
# | 10 |
Given /I am logged in/ do
Given "I am a registered user"
Given "I log in"
end
Given /I am a logged in admin/ do
Given "I am a registered admin"
Given "I log in"
end
Given /^I am a registered user$/ do
@this_user = Factory(:user, :is_local_account => true)
end
Given /^I am a registered admin$/ do
@this_user = Factory(:user, :is_local_account => true, :is_admin => true)
end
When /^I log in$/ do
visit "/login"
fill_in "user_session_login", :with => @this_user.login
fill_in "user_session_password", :with => @this_user.password
click_button "user_session_submit"
end
When /^I log in as "(.*)"$/ do |login|
pending
visit "/login"
#assert https?
#assert_equal '/admin/sessions/new', path
# puts response.body
this_user = Factory(:user)
fill_in "user_login", :with => this_user.login
fill_in "user_password", :with => this_user.password
clicks_button("Login")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment