class ActionDispatch::TestRequest
Constants
- DEFAULT_ENV
Public Class Methods
new(env = {})
click to toggle source
Calls superclass method
ActionDispatch::Request.new
# File lib/action_dispatch/testing/test_request.rb, line 12 def self.new(env = {}) super end
new(env = {})
click to toggle source
Calls superclass method
ActionDispatch::Request.new
# File lib/action_dispatch/testing/test_request.rb, line 16 def initialize(env = {}) env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application super(default_env.merge(env)) end
Public Instance Methods
accept=(mime_types)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 61 def accept=(mime_types) @env.delete('action_dispatch.request.accepts') @env['HTTP_ACCEPT'] = Array(mime_types).collect { |mime_type| mime_type.to_s }.join(",") end
action=(action_name)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 41 def action=(action_name) path_parameters[:action] = action_name.to_s end
host=(host)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 25 def host=(host) @env['HTTP_HOST'] = host end
if_modified_since=(last_modified)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 45 def if_modified_since=(last_modified) @env['HTTP_IF_MODIFIED_SINCE'] = last_modified end
if_none_match=(etag)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 49 def if_none_match=(etag) @env['HTTP_IF_NONE_MATCH'] = etag end
path=(path)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 37 def path=(path) @env['PATH_INFO'] = path end
port=(number)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 29 def port=(number) @env['SERVER_PORT'] = number.to_i end
remote_addr=(addr)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 53 def remote_addr=(addr) @env['REMOTE_ADDR'] = addr end
request_method=(method)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 21 def request_method=(method) @env['REQUEST_METHOD'] = method.to_s.upcase end
request_uri=(uri)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 33 def request_uri=(uri) @env['REQUEST_URI'] = uri end
user_agent=(user_agent)
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 57 def user_agent=(user_agent) @env['HTTP_USER_AGENT'] = user_agent end
Private Instance Methods
default_env()
click to toggle source
# File lib/action_dispatch/testing/test_request.rb, line 74 def default_env DEFAULT_ENV end