method
new
v3.2.8 -
Show latest stable
-
2 notes -
Class: ActionController::TestRequest
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (0)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- What's this?
Register or
log in
to add new notes.
weibel -
May 19, 2009 - (>= v2.2.1)
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' }
jrochkind -
May 6, 2014
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") )