Class: Authlogic::TestCase::MockController

Inherits:
ControllerAdapters::AbstractAdapter show all
Defined in:
lib/novelys_authlogic/test_case/mock_controller.rb

Overview

Basically acts like a controller but doesn’t do anything. Authlogic can interact with this, do it’s thing and then you can look at the controller object to see if anything changed.

Instance Attribute Summary collapse

Attributes inherited from ControllerAdapters::AbstractAdapter

#controller

Instance Method Summary collapse

Methods inherited from ControllerAdapters::AbstractAdapter

#last_request_update_allowed?, #responds_to_last_request_update_allowed?, #responds_to_single_access_allowed?, #single_access_allowed?

Constructor Details

#initializeMockController

Returns a new instance of MockController.



9
10
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 9

def initialize
end

Dynamic Method Handling

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

Instance Attribute Details

#http_passwordObject

Returns the value of attribute http_password.



6
7
8
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 6

def http_password
  @http_password
end

#http_userObject

Returns the value of attribute http_user.



6
7
8
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 6

def http_user
  @http_user
end

#request_content_typeObject



36
37
38
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 36

def request_content_type
  @request_content_type ||= "text/html"
end

Instance Method Details

#authenticate_with_http_basic {|http_user, http_password| ... } ⇒ Object



12
13
14
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 12

def authenticate_with_http_basic(&block)
  yield http_user, http_password
end


20
21
22
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 20

def cookie_domain
  nil
end

#cookiesObject



16
17
18
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 16

def cookies
  @cookies ||= MockCookieJar.new
end

#loggerObject



24
25
26
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 24

def logger
  @logger ||= MockLogger.new
end

#paramsObject



28
29
30
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 28

def params
  @params ||= {}
end

#requestObject



32
33
34
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 32

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

#sessionObject



40
41
42
# File 'lib/novelys_authlogic/test_case/mock_controller.rb', line 40

def session
  @session ||= {}
end