Class: ExceptionHandling::Testing::ControllerStub

Inherits:
Object
  • Object
show all
Includes:
Methods
Defined in:
lib/exception_handling/testing.rb

Defined Under Namespace

Classes: Request

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeControllerStub



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/exception_handling/testing.rb', line 25

def initialize
  @request = Request.new
  @session_id = "ZKL95"
  @session =
      if defined?(Username)
        {
          :login_count => 22,
          :username_id => Username.first.id,
          :user_id     => User.first.id,
        }
      else
        { }
      end
end

Class Attribute Details

.around_filter_methodObject

Returns the value of attribute around_filter_method.



22
23
24
# File 'lib/exception_handling/testing.rb', line 22

def around_filter_method
  @around_filter_method
end

Instance Attribute Details

#requestObject

Returns the value of attribute request.



20
21
22
# File 'lib/exception_handling/testing.rb', line 20

def request
  @request
end

#sessionObject

Returns the value of attribute session.



20
21
22
# File 'lib/exception_handling/testing.rb', line 20

def session
  @session
end

Class Method Details

.around_filter(method) ⇒ Object



52
53
54
# File 'lib/exception_handling/testing.rb', line 52

def self.around_filter( method )
  ControllerStub.around_filter_method = method
end

Instance Method Details

#action_nameObject



48
49
50
# File 'lib/exception_handling/testing.rb', line 48

def action_name
  "test_action"
end

#complete_request_uriObject



56
57
58
# File 'lib/exception_handling/testing.rb', line 56

def complete_request_uri
  "#{@request.protocol}#{@request.host}#{@request.request_uri}"
end

#controller_nameObject



44
45
46
# File 'lib/exception_handling/testing.rb', line 44

def controller_name
  "ControllerStub"
end

#simulate_around_filter(&block) ⇒ Object



40
41
42
# File 'lib/exception_handling/testing.rb', line 40

def simulate_around_filter( &block )
  set_current_controller( &block )
end