Class: ActionController::TestRequest

Inherits:
AbstractRequest show all
Defined in:
lib/action_controller/test_process.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractRequest

#delete?, #get?, #head?, #host_with_port, #method, #parameters, #port, #post?, #protocol, #put?, #remote_ip, #ssl?

Constructor Details

#initialize(query_parameters = nil, request_parameters = nil, session = nil) ⇒ TestRequest

Returns a new instance of TestRequest.



21
22
23
24
25
26
27
28
29
30
# File 'lib/action_controller/test_process.rb', line 21

def initialize(query_parameters = nil, request_parameters = nil, session = nil)
  @query_parameters   = query_parameters || {}
  @request_parameters = request_parameters || {}
  @session            = session || TestSession.new
  
  initialize_containers
  initialize_default_values

  super()
end

Instance Attribute Details

#cookiesObject



36
37
38
# File 'lib/action_controller/test_process.rb', line 36

def cookies
  @cookies.freeze
end

#envObject

Returns the value of attribute env.



18
19
20
# File 'lib/action_controller/test_process.rb', line 18

def env
  @env
end

#hostObject

Returns the value of attribute host.



19
20
21
# File 'lib/action_controller/test_process.rb', line 19

def host
  @host
end

#pathObject

Returns the value of attribute path.



19
20
21
# File 'lib/action_controller/test_process.rb', line 19

def path
  @path
end

#query_parametersObject

Returns the value of attribute query_parameters.



18
19
20
# File 'lib/action_controller/test_process.rb', line 18

def query_parameters
  @query_parameters
end

#remote_addrObject

Returns the value of attribute remote_addr.



19
20
21
# File 'lib/action_controller/test_process.rb', line 19

def remote_addr
  @remote_addr
end

#request_parametersObject

Returns the value of attribute request_parameters.



18
19
20
# File 'lib/action_controller/test_process.rb', line 18

def request_parameters
  @request_parameters
end

#request_uriObject

Returns the value of attribute request_uri.



19
20
21
# File 'lib/action_controller/test_process.rb', line 19

def request_uri
  @request_uri
end

#sessionObject

Returns the value of attribute session.



18
19
20
# File 'lib/action_controller/test_process.rb', line 18

def session
  @session
end

Instance Method Details

#action=(action_name) ⇒ Object



40
41
42
43
# File 'lib/action_controller/test_process.rb', line 40

def action=(action_name)
  @query_parameters.update({ "action" => action_name })
  @parameters = nil
end

#reset_sessionObject



32
33
34
# File 'lib/action_controller/test_process.rb', line 32

def reset_session
  @session = {}
end