Created
July 29, 2010 13:51
-
-
Save philcrissman/498171 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# ... other require statements | |
require 'authlogic/test_case' | |
class ActiveSupport::TestCase | |
# ... whatever is already in here | |
def login_as(user) | |
activate_authlogic | |
user_session = UserSession.new(:email => user.email, :password => 'asdfasdf') | |
user_session.save! | |
return false | |
end | |
end | |
## Then in your test... | |
class UsersControllerTest # etc | |
setup do | |
@user = # make a user with User.new, factory, etc | |
login_as(@user) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment