- A
- C
- H
- I
- P
- R
- U
Constants
| DEFAULT_ENV | = | Rack::MockRequest.env_for("/", "HTTP_HOST" => "test.host".b, "REMOTE_ADDR" => "0.0.0.0".b, "HTTP_USER_AGENT" => "Rails Testing".b, ) |
Class Public methods
create(env = {}) Link
Create a new test request with default env values.
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 15 def self.create(env = {}) env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application env["rack.request.cookie_hash"] ||= {}.with_indifferent_access new(default_env.merge(env)) end
Instance Public methods
accept=(mime_types) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 66 def accept=(mime_types) delete_header("action_dispatch.request.accepts") set_header("HTTP_ACCEPT", Array(mime_types).collect(&:to_s).join(",")) end
action=(action_name) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 46 def action=(action_name) path_parameters[:action] = action_name.to_s end
host=(host) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 30 def host=(host) set_header("HTTP_HOST", host) end
if_modified_since=(last_modified) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 50 def if_modified_since=(last_modified) set_header("HTTP_IF_MODIFIED_SINCE", last_modified) end
if_none_match=(etag) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 54 def if_none_match=(etag) set_header("HTTP_IF_NONE_MATCH", etag) end
path=(path) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 42 def path=(path) set_header("PATH_INFO", path) end
port=(number) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 34 def port=(number) set_header("SERVER_PORT", number.to_i) end
remote_addr=(addr) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 58 def remote_addr=(addr) set_header("REMOTE_ADDR", addr) end
request_method=(method) Link
Source: show
# File actionpack/lib/action_dispatch/testing/test_request.rb, line 26 def request_method=(method) super(method.to_s.upcase) end