# class ActionDispatch::TestRequest

### Constants

DEFAULT_ENV

### Public Class Methods

new(env = {}) click to toggle source
Calls superclass method

    # File lib/action_dispatch/testing/test_request.rb, line 10
    def self.new(env = {})
      super
    end

new(env = {}) click to toggle source
Calls superclass method

    # File lib/action_dispatch/testing/test_request.rb, line 14
    def initialize(env = {})
      env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application
      super(DEFAULT_ENV.merge(env))

      self.host        = 'test.host'
      self.remote_addr = '0.0.0.0'
      self.user_agent  = 'Rails Testing'
    end

### Public Instance Methods

accept=(mime_types) click to toggle source

    # File lib/action_dispatch/testing/test_request.rb, line 63
    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 43
    def action=(action_name)
      path_parameters["action"] = action_name.to_s
    end

cookies() click to toggle source

    # File lib/action_dispatch/testing/test_request.rb, line 70
    def cookies
      @cookies ||= {}.with_indifferent_access
    end

Also aliased as: rack_cookies
host=(host) click to toggle source

    # File lib/action_dispatch/testing/test_request.rb, line 27
    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 47
    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 51
    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 39
    def path=(path)
      @env['PATH_INFO'] = path
    end

port=(number) click to toggle source

    # File lib/action_dispatch/testing/test_request.rb, line 31
    def port=(number)
      @env['SERVER_PORT'] = number.to_i
    end

rack_cookies()
Alias for: cookies
remote_addr=(addr) click to toggle source

    # File lib/action_dispatch/testing/test_request.rb, line 55
    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 23
    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 35
    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 59
    def user_agent=(user_agent)
      @env['HTTP_USER_AGENT'] = user_agent
    end