method

new

new(query_parameters = nil, request_parameters = nil, session = nil)
public

No documentation available.

# File actionpack/lib/action_controller/test_process.rb, line 36
    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

2Notes

How to set request parameters

weibel · May 19, 20092 thanks

On previous versions of TestRequest it was possible to set the request_parameters on the new action. This option is now gone, but it's still possible to set the parameters after initialization.

==== Code example

request = ActionController::TestRequest.new request.env["action_controller.request.request_parameters"] = { :foo => '42', :bar => '24' }

How to set request parameters (rails 3.2)

jrochkind · May 6, 2014

In Rails 3.2, this seems to work to create a TestRequest based on a certain url:

ActionController::TestRequest.new( Rack::MockRequest.env_for("http://something.tld/foo?one=two&three=four") )