diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-05-04 14:31:28 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-05-04 14:31:28 +0200 |
commit | 52d9746119f07bcb2182f39e539add9b20199ce6 (patch) | |
tree | 9adeda60b7b34376b20000fc67a570d922b0d21e /actionpack | |
parent | 242bcac17b2b8397bd1ff77a2bddc37fc6628939 (diff) | |
parent | 4a43769947d5ef844c13e56e36b2d4d85a6c29e6 (diff) | |
download | rails-52d9746119f07bcb2182f39e539add9b20199ce6.tar.gz rails-52d9746119f07bcb2182f39e539add9b20199ce6.tar.bz2 rails-52d9746119f07bcb2182f39e539add9b20199ce6.zip |
Merge pull request #14923 from gaurish/document-testcase-process
Document ActionController::TestCase::Behavior#process
[ci skip]
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index caaebc537a..e958cfecdf 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -550,6 +550,33 @@ module ActionController end end + # Simulate a HTTP request to +action+ by specifying request method, + # parameters and set/volley the response. + # + # - +action+: The controller action to call. + # - +http_method+: request method used to send http request. + # possible values GET, POST, HEAD, PUT, DELETE, PATCH. defaults to GET. + # - +parameters+: The HTTP parameters. + # This may be +nil+, a hash, or 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+. + # + # example: calling +create+ action & sending two params + # + # process :create, 'POST', user: { name: 'Gaurish Sharma', email: 'user@example.com' } + # + # another example with parameters, +nil+ session & flash message + # + # process :view, 'GET', { id: 7 }, nil, { message: 'This is flash message' } + # + # To simulate +GET+, +POST+, +PATCH+, +PUT+, + # +DELETE+ and +HEAD+ requests prefer using #get, #post, #patch, #put, + # #delete and #head respectively which will make tests more expressive. + # + # Note that the request method is not verified. def process(action, http_method = 'GET', *args) check_required_ivars |