Class: Authentication::Logic::TestCase::RailsRequestAdapter

Inherits:
ControllerAdapters::AbstractAdapter show all
Defined in:
lib/auth/logic/test_case/rails_request_adapter.rb

Overview

Adapts authlogic to work with the @request object when testing. This way Authentication::Logic can set cookies and what not before a request is made, ultimately letting you log in users in functional tests.

Constant Summary

Constants inherited from ControllerAdapters::AbstractAdapter

ControllerAdapters::AbstractAdapter::ENV_SESSION_OPTIONS, ControllerAdapters::AbstractAdapter::E_COOKIE_DOMAIN_ADAPTER

Instance Attribute Summary

Attributes inherited from ControllerAdapters::AbstractAdapter

#controller

Instance Method Summary collapse

Methods inherited from ControllerAdapters::AbstractAdapter

#initialize, #last_request_update_allowed?, #params, #renew_session_id, #respond_to_missing?, #responds_to_single_access_allowed?, #session, #single_access_allowed?

Constructor Details

This class inherits a constructor from Authentication::Logic::ControllerAdapters::AbstractAdapter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Authentication::Logic::ControllerAdapters::AbstractAdapter

Instance Method Details

#authenticate_with_http_basic(&block) ⇒ Object



10
# File 'lib/auth/logic/test_case/rails_request_adapter.rb', line 10

def authenticate_with_http_basic(&block); end


20
21
22
# File 'lib/auth/logic/test_case/rails_request_adapter.rb', line 20

def cookie_domain
  nil
end

#cookiesObject



12
13
14
15
16
17
18
# File 'lib/auth/logic/test_case/rails_request_adapter.rb', line 12

def cookies
  new_cookies = MockCookieJar.new
  super.each do |key, value|
    new_cookies[key] = cookie_value(value)
  end
  new_cookies
end

#requestObject



24
25
26
# File 'lib/auth/logic/test_case/rails_request_adapter.rb', line 24

def request
  @request ||= MockRequest.new(controller)
end

#request_content_typeObject



28
29
30
# File 'lib/auth/logic/test_case/rails_request_adapter.rb', line 28

def request_content_type
  request.format.to_s
end