Skip to content

Instantly share code, notes, and snippets.

@noelrappin
Created June 12, 2009 14:13
Show Gist options
  • Save noelrappin/128651 to your computer and use it in GitHub Desktop.
Save noelrappin/128651 to your computer and use it in GitHub Desktop.
# using machinist and Authlogic to crat
def login!(options = {})
user = User.make(options)
set_session_for(user)
user
end
def set_session_for(user)
UserSession.create(user)
end
def admin!(options = {})
login!(options.merge({:admin => true}))
end
# usage
test "show profile to a logged in user" do
user = login!
get :show, :id => user.id
# and so on
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment