Class: ActionController::TestRequest
- Inherits:
-
AbstractRequest
- Object
- AbstractRequest
- ActionController::TestRequest
- Defined in:
- lib/action_controller/test_process.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#env ⇒ Object
Returns the value of attribute env.
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#query_parameters ⇒ Object
Returns the value of attribute query_parameters.
-
#remote_addr ⇒ Object
Returns the value of attribute remote_addr.
-
#request_parameters ⇒ Object
Returns the value of attribute request_parameters.
-
#session ⇒ Object
Returns the value of attribute session.
Instance Method Summary collapse
- #action=(action_name) ⇒ Object
-
#initialize(query_parameters = nil, request_parameters = nil, session = nil) ⇒ TestRequest
constructor
A new instance of TestRequest.
- #port=(number) ⇒ Object
- #request_uri ⇒ Object
- #request_uri=(uri) ⇒ Object
- #reset_session ⇒ Object
-
#set_REQUEST_URI(value) ⇒ Object
Used to check AbstractRequest’s request_uri functionality.
Methods inherited from AbstractRequest
#delete?, #domain, #get?, #head?, #host_with_port, #method, #parameters, #path_parameters, #path_parameters=, #port, #port_string, #post?, #protocol, #put?, #raw_post, #relative_url_root, #remote_ip, #ssl?, #subdomains
Constructor Details
#initialize(query_parameters = nil, request_parameters = nil, session = nil) ⇒ TestRequest
Returns a new instance of TestRequest.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/action_controller/test_process.rb', line 37 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
#cookies ⇒ Object
Returns the value of attribute cookies.
33 34 35 |
# File 'lib/action_controller/test_process.rb', line 33 def @cookies end |
#env ⇒ Object
Returns the value of attribute env.
34 35 36 |
# File 'lib/action_controller/test_process.rb', line 34 def env @env end |
#host ⇒ Object
Returns the value of attribute host.
35 36 37 |
# File 'lib/action_controller/test_process.rb', line 35 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
34 35 36 |
# File 'lib/action_controller/test_process.rb', line 34 def path @path end |
#query_parameters ⇒ Object
Returns the value of attribute query_parameters.
34 35 36 |
# File 'lib/action_controller/test_process.rb', line 34 def query_parameters @query_parameters end |
#remote_addr ⇒ Object
Returns the value of attribute remote_addr.
35 36 37 |
# File 'lib/action_controller/test_process.rb', line 35 def remote_addr @remote_addr end |
#request_parameters ⇒ Object
Returns the value of attribute request_parameters.
34 35 36 |
# File 'lib/action_controller/test_process.rb', line 34 def request_parameters @request_parameters end |
#session ⇒ Object
Returns the value of attribute session.
34 35 36 |
# File 'lib/action_controller/test_process.rb', line 34 def session @session end |
Instance Method Details
#action=(action_name) ⇒ Object
56 57 58 59 |
# File 'lib/action_controller/test_process.rb', line 56 def action=(action_name) @query_parameters.update({ "action" => action_name }) @parameters = nil end |
#port=(number) ⇒ Object
52 53 54 |
# File 'lib/action_controller/test_process.rb', line 52 def port=(number) @env["SERVER_PORT"] = number.to_i end |
#request_uri ⇒ Object
74 75 76 |
# File 'lib/action_controller/test_process.rb', line 74 def request_uri @request_uri || super() end |
#request_uri=(uri) ⇒ Object
69 70 71 72 |
# File 'lib/action_controller/test_process.rb', line 69 def request_uri=(uri) @request_uri = uri @path = uri.split("?").first end |
#reset_session ⇒ Object
48 49 50 |
# File 'lib/action_controller/test_process.rb', line 48 def reset_session @session = {} end |
#set_REQUEST_URI(value) ⇒ Object
Used to check AbstractRequest’s request_uri functionality. Disables the use of @path and @request_uri so superclass can handle those.
63 64 65 66 67 |
# File 'lib/action_controller/test_process.rb', line 63 def set_REQUEST_URI(value) @env["REQUEST_URI"] = value @request_uri = nil @path = nil end |