module AuthenticatedTestHelper # Sets the current account in the session from the account fixtures. def login_as(account) @request.session[:account_id] = account ? accounts(account).id : nil end def authorize_as(user) @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Basic.encode_credentials(users(user).login, 'test') : nil end end