changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/restful_authentication/generators/authenticated/templates/authenticated_test_helper.rb

changeset 4: 43c5e6930eee
author: moriq@moriq.com
date: Wed Mar 05 01:17:41 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugin restful_authentication.
1module AuthenticatedTestHelper
2 # Sets the current <%= file_name %> in the session from the <%= file_name %> fixtures.
3 def login_as(<%= file_name %>)
4 @request.session[:<%= file_name %>_id] = <%= file_name %> ? <%= table_name %>(<%= file_name %>).id : nil
5 end
6
7 def authorize_as(user)
8 @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Basic.encode_credentials(users(user).login, 'test') : nil
9 end
10end