Class: Authlogic::TestCase::MockController

Inherits:
ControllerAdapters::AbstractAdapter show all
Defined in:
lib/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.

Constant Summary

Constants inherited from ControllerAdapters::AbstractAdapter

ControllerAdapters::AbstractAdapter::E_COOKIE_DOMAIN_ADAPTER

Instance Attribute Summary collapse

Attributes inherited from ControllerAdapters::AbstractAdapter

#controller

Instance Method Summary collapse

Methods inherited from ControllerAdapters::AbstractAdapter

#last_request_update_allowed?, #respond_to_missing?, #responds_to_single_access_allowed?, #single_access_allowed?

Constructor Details

#initializeMockController

Returns a new instance of MockController.



10
11
# File 'lib/authlogic/test_case/mock_controller.rb', line 10

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.



7
8
9
# File 'lib/authlogic/test_case/mock_controller.rb', line 7

def http_password
  @http_password
end

#http_userObject

Returns the value of attribute http_user.



7
8
9
# File 'lib/authlogic/test_case/mock_controller.rb', line 7

def http_user
  @http_user
end

#realmObject

Returns the value of attribute realm.



7
8
9
# File 'lib/authlogic/test_case/mock_controller.rb', line 7

def realm
  @realm
end

#request_content_typeObject



43
44
45
# File 'lib/authlogic/test_case/mock_controller.rb', line 43

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

Instance Method Details

#authenticate_or_request_with_http_basic(realm = "DefaultRealm") {|http_user, http_password| ... } ⇒ Object



17
18
19
20
21
# File 'lib/authlogic/test_case/mock_controller.rb', line 17

def authenticate_or_request_with_http_basic(realm = "DefaultRealm")
  self.realm = realm
  @http_auth_requested = true
  yield http_user, http_password
end

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



13
14
15
# File 'lib/authlogic/test_case/mock_controller.rb', line 13

def authenticate_with_http_basic
  yield http_user, http_password
end


27
28
29
# File 'lib/authlogic/test_case/mock_controller.rb', line 27

def cookie_domain
  nil
end

#cookiesObject



23
24
25
# File 'lib/authlogic/test_case/mock_controller.rb', line 23

def cookies
  @cookies ||= MockCookieJar.new
end

#http_auth_requested?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/authlogic/test_case/mock_controller.rb', line 51

def http_auth_requested?
  @http_auth_requested ||= false
end

#loggerObject



31
32
33
# File 'lib/authlogic/test_case/mock_controller.rb', line 31

def logger
  @logger ||= MockLogger.new
end

#paramsObject



35
36
37
# File 'lib/authlogic/test_case/mock_controller.rb', line 35

def params
  @params ||= {}
end

#requestObject



39
40
41
# File 'lib/authlogic/test_case/mock_controller.rb', line 39

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

#sessionObject



47
48
49
# File 'lib/authlogic/test_case/mock_controller.rb', line 47

def session
  @session ||= {}
end