process
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 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 (38)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1
- 5.1.7 (7)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (10)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
process(action, method: "GET", params: nil, session: nil, body: nil, flash: {}, format: nil, xhr: false, as: nil)
public
Simulate an HTTP request to action by specifying request method, parameters and set/volley the response.
-
action: The controller action to call.
-
method: Request method used to send the HTTP request. Possible values are GET, POST, PATCH, PUT, DELETE, HEAD. Defaults to GET. Can be a symbol.
-
params: The hash with HTTP parameters that you want to pass. This may be nil.
-
body: The request body with a string that is appropriately encoded (application/x-www-form-urlencoded or multipart/form-data).
-
session: A hash of parameters to store in the session. This may be nil.
-
flash: A hash of parameters to store in the flash. This may be nil.
-
format: Request format. Defaults to nil. Can be string or symbol.
-
as: Content type. Defaults to nil. Must be a symbol that corresponds to a mime type.
Example calling create action and sending two params:
process :create, method: 'POST', params: { user: { name: 'Gaurish Sharma', email: 'user@example.com' } }, session: { user_id: 1 }, flash: { notice: 'This is flash message' }
To simulate GET, POST, PATCH, PUT, DELETE and HEAD requests prefer using #get, #post, #patch, #put, #delete and #head methods respectively which will make tests more expressive.
Note that the request method is not verified.