Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created August 4, 2008 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agibralter/3927 to your computer and use it in GitHub Desktop.
Save agibralter/3927 to your computer and use it in GitHub Desktop.
Given("no Users and no BetaUsers") do
User.delete_all
BetaUser.delete_all
end
Given("a User with no login, email '$email', and password '$password'") do |email, password|
Factory(:user, :email => email, :login => nil, :password => password, :password_confirmation => password)
end
Given("a BetaUser '$email'") do |email|
@beta_user = Factory(:beta_user, :email => email)
end
# THIS one breaks my stories! is there something wrong with my post and delete here?
Given("a BetaUser '$email' who is no bum") do |email|
beta_user = Factory(:beta_user, :email => email)
post_via_redirect '/users', :user => {:email => email, :password => 'password', :password_confirmation => 'password'}, :beta_code => beta_user.beta_code
delete_via_redirect '/session'
end
Given("'$login_or_email' logged in with password '$password'") do |login_or_email, password|
post '/session', { :login_or_email => login_or_email, :password => password }
# require 'ruby-debug'
# debugger
# response.body is empty!!! WTF
response.should be_redirect
end
Scenario: An admin viewing the bums only list of beta users
Given no Users and no BetaUsers
And a User with no login, email 'admin@site.com', and password 'I like cats'
And a BetaUser 'jimbo1@fat.com'
And a BetaUser 'jimbo2@fat.com' who is no bum
And 'admin@site.com' logged in with password 'I like cats' (FAILED) # response.body is empty!
When that user requests '/admin/beta_users' with bums_only true
Then that user should see a list of beta users including 'jimbo1@fat.com'
And that user should see a list of beta users not including 'jimbo2@fat.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment