Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created August 4, 2008 16:57
Show Gist options
  • 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 '[email protected]', and password 'I like cats'
And a BetaUser '[email protected]'
And a BetaUser '[email protected]' who is no bum
And '[email protected]' 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 '[email protected]'
And that user should see a list of beta users not including '[email protected]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment