Created
June 12, 2009 14:13
-
-
Save noelrappin/128651 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
# 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