Class: Authlogic::TestCase::RailsRequestAdapter

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

Overview

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

Instance Attribute Summary

Attributes inherited from ControllerAdapters::AbstractAdapter

#controller

Instance Method Summary (collapse)

Methods inherited from ControllerAdapters::AbstractAdapter

#initialize, #last_request_update_allowed?, #params, #responds_to_last_request_update_allowed?, #responds_to_single_access_allowed?, #session, #single_access_allowed?

Constructor Details

This class inherits a constructor from Authlogic::ControllerAdapters::AbstractAdapter

Dynamic Method Handling

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

Instance Method Details

- (Object) authenticate_with_http_basic(&block)



6
7
# File 'lib/authlogic/test_case/rails_request_adapter.rb', line 6

def authenticate_with_http_basic(&block)
end


17
18
19
# File 'lib/authlogic/test_case/rails_request_adapter.rb', line 17

def cookie_domain
  nil
end

- (Object) cookies



9
10
11
12
13
14
15
# File 'lib/authlogic/test_case/rails_request_adapter.rb', line 9

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

- (Object) request



21
22
23
# File 'lib/authlogic/test_case/rails_request_adapter.rb', line 21

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

- (Object) request_content_type



25
26
27
# File 'lib/authlogic/test_case/rails_request_adapter.rb', line 25

def request_content_type
  request.format.to_s
end