Method: Merb::Test::RequestHelper#fake_request
- Defined in:
- lib/merb-core/test/helpers/mock_request_helper.rb
#fake_request(env = {}, opt = {}) ⇒ Object
Deprecated.
Parameters
- env<Hash>
-
A hash of environment keys to be merged into the default list.
- opt<Hash>
-
A hash of options (see below).
Options (opt)
- :post_body<String>
-
The post body for the request.
- :req<String>
-
The request string. This will only be used if :post_body is left out.
Returns
- FakeRequest
-
A Request object that is built based on the parameters.
Notes
If you pass a post body, the content-type will be set to URL-encoded.
:api: public
79 80 81 82 83 84 85 86 87 |
# File 'lib/merb-core/test/helpers/mock_request_helper.rb', line 79 def fake_request(env = {}, opt = {}) if opt[:post_body] req = opt[:post_body] env[:content_type] ||= "application/x-www-form-urlencoded" else req = opt[:req] end FakeRequest.new(env, StringIO.new(req || '')) end |