method
new
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
Register or
log in
to add new notes.
weibel -
May 19, 2009 - (>= v2.2.1)
jrochkind -
May 6, 2014
![Default_avatar_30](https://www.gravatar.com/avatar/b39d86f427c04b5df1e8ceca920bd14d?default=http://apidock.com/images/default_avatar_30.png&size=30)
2 thanks
How to set request parameters
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' }
![Default_avatar_30](https://www.gravatar.com/avatar/6a13e655e637138f8d571cec3f9cea76?default=http://apidock.com/images/default_avatar_30.png&size=30)
0 thanks
How to set request parameters (rails 3.2)
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") )