diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-12-17 00:39:19 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-12-17 00:39:19 +0000 |
commit | 0f6c86ff40d0b0efe672ae76f2b5b536feaf7255 (patch) | |
tree | 61bc174fe871cfccf8d8af39e664959918896b12 /actionpack/lib | |
parent | be0c45365c912240b4979150f8c1284916007bca (diff) | |
download | rails-0f6c86ff40d0b0efe672ae76f2b5b536feaf7255.tar.gz rails-0f6c86ff40d0b0efe672ae76f2b5b536feaf7255.tar.bz2 rails-0f6c86ff40d0b0efe672ae76f2b5b536feaf7255.zip |
Added delete_via_redirect and put_via_redirect to integration testing (closes #10497) [philodespotos]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8429 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/integration.rb | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 75e6796dc9..25fb1b93af 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -121,23 +121,38 @@ module ActionController status end - # Performs a GET request, following any subsequent redirect. Note that - # the redirects are followed until the response is not a redirect--this - # means you may run into an infinite loop if your redirect loops back to - # itself. Headers are treated in the same way as #get. - def get_via_redirect(path, args={}, headers = {}) - get path, args, headers + # Performs a request using the specified method, following any subsequent + # redirect. Note that the redirects are followed until the response is + # not a redirect--this means you may run into an infinite loop if your + # redirect loops back to itself. + def request_via_redirect(http_method, path, parameters = nil, headers = nil) + send(http_method, path, parameters, headers) follow_redirect! while redirect? status end - # Performs a POST request, following any subsequent redirect. This is - # vulnerable to infinite loops, the same as #get_via_redirect. Headers are - # treated in the same way as #get. - def post_via_redirect(path, args={}, headers = {}) - post path, args, headers - follow_redirect! while redirect? - status + # Performs a GET request, following any subsequent redirect. + # See #request_via_redirect() for more information. + def get_via_redirect(path, parameters = nil, headers = nil) + request_via_redirect(:get, path, parameters, headers) + end + + # Performs a POST request, following any subsequent redirect. + # See #request_via_redirect() for more information. + def post_via_redirect(path, parameters = nil, headers = nil) + request_via_redirect(:post, path, parameters, headers) + end + + # Performs a PUT request, following any subsequent redirect. + # See #request_via_redirect() for more information. + def put_via_redirect(path, parameters = nil, headers = nil) + request_via_redirect(:put, path, parameters, headers) + end + + # Performs a DELETE request, following any subsequent redirect. + # See #request_via_redirect() for more information. + def delete_via_redirect(path, parameters = nil, headers = nil) + request_via_redirect(:delete, path, parameters, headers) end # Returns +true+ if the last response was a redirect. |