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.

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

- (MockController) initialize

Returns a new instance of MockController



9
10
# File 'lib/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

- (Object) http_password

Returns the value of attribute http_password



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

def http_password
  @http_password
end

- (Object) http_user

Returns the value of attribute http_user



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

def http_user
  @http_user
end

- (Object) realm

Returns the value of attribute realm



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

def realm
  @realm
end

- (Object) request_content_type



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

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

Instance Method Details

- (Object) authenticate_or_request_with_http_basic(realm = 'DefaultRealm') {|http_user, http_password| ... }

Yields:

  • (http_user, http_password)


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

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

- (Object) authenticate_with_http_basic {|http_user, http_password| ... }

Yields:

  • (http_user, http_password)


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

def authenticate_with_http_basic(&block)
  yield http_user, http_password
end


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

def cookie_domain
  nil
end

- (Object) cookies



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

def cookies
  @cookies ||= MockCookieJar.new
end

- (Boolean) http_auth_requested?

Returns:

  • (Boolean)


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

def http_auth_requested?
  @http_auth_requested ||= false
end

- (Object) logger



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

def logger
  @logger ||= MockLogger.new
end

- (Object) params



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

def params
  @params ||= {}
end

- (Object) request



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

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

- (Object) session



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

def session
  @session ||= {}
end