Performs a DELETE request with the given parameters. See get() for more details.
# File lib/action_dispatch/testing/integration.rb, line 49 49: def delete(path, parameters = nil, headers = nil) 50: process :delete, path, parameters, headers 51: end
Performs a DELETE request, following any subsequent redirect. See request_via_redirect for more information.
# File lib/action_dispatch/testing/integration.rb, line 113 113: def delete_via_redirect(path, parameters = nil, headers = nil) 114: request_via_redirect(:delete, path, parameters, headers) 115: end
Follow a single redirect response. If the last response was not a redirect, an exception will be raised. Otherwise, the redirect is performed on the location header.
# File lib/action_dispatch/testing/integration.rb, line 77 77: def follow_redirect! 78: raise "not a redirect! #{status} #{status_message}" unless redirect? 79: get(response.location) 80: status 81: end
Performs a GET request with the given parameters.
path: The URI (as a String) on which you want to perform a GET request.
parameters: The HTTP parameters that you want to pass. This may be nil, a Hash, or a String that is appropriately encoded (application/x-www-form-urlencoded or multipart/form-data).
headers: Additional HTTP headers to pass, as a Hash. The keys will automatically be upcased, with the prefix ‘HTTP_’ added if needed.
This method returns an Response object, which one can use to inspect the details of the response. Furthermore, if this method was called from an ActionDispatch::IntegrationTest object, then that object’s @response instance variable will point to the same response object.
You can also perform POST, PUT, DELETE, and HEAD requests with post, put, delete, and head.
# File lib/action_dispatch/testing/integration.rb, line 31 31: def get(path, parameters = nil, headers = nil) 32: process :get, path, parameters, headers 33: end
Performs a GET request, following any subsequent redirect. See request_via_redirect for more information.
# File lib/action_dispatch/testing/integration.rb, line 95 95: def get_via_redirect(path, parameters = nil, headers = nil) 96: request_via_redirect(:get, path, parameters, headers) 97: end
Performs a HEAD request with the given parameters. See get() for more details.
# File lib/action_dispatch/testing/integration.rb, line 55 55: def head(path, parameters = nil, headers = nil) 56: process :head, path, parameters, headers 57: end
Performs a POST request with the given parameters. See get() for more details.
# File lib/action_dispatch/testing/integration.rb, line 37 37: def post(path, parameters = nil, headers = nil) 38: process :post, path, parameters, headers 39: end
Performs a POST request, following any subsequent redirect. See request_via_redirect for more information.
# File lib/action_dispatch/testing/integration.rb, line 101 101: def post_via_redirect(path, parameters = nil, headers = nil) 102: request_via_redirect(:post, path, parameters, headers) 103: end
Performs a PUT request with the given parameters. See get() for more details.
# File lib/action_dispatch/testing/integration.rb, line 43 43: def put(path, parameters = nil, headers = nil) 44: process :put, path, parameters, headers 45: end
Performs a PUT request, following any subsequent redirect. See request_via_redirect for more information.
# File lib/action_dispatch/testing/integration.rb, line 107 107: def put_via_redirect(path, parameters = nil, headers = nil) 108: request_via_redirect(:put, path, parameters, headers) 109: end
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.
# File lib/action_dispatch/testing/integration.rb, line 87 87: def request_via_redirect(http_method, path, parameters = nil, headers = nil) 88: process(http_method, path, parameters, headers) 89: follow_redirect! while redirect? 90: status 91: end
Performs an XMLHttpRequest request with the given parameters, mirroring a request from the Prototype library.
The request_method is :get, :post, :put, :delete or :head; the parameters are nil, a hash, or a url-encoded or multipart string; the headers are a hash. Keys are automatically upcased and prefixed with ‘HTTP_’ if not already.
# File lib/action_dispatch/testing/integration.rb, line 66 66: def xml_http_request(request_method, path, parameters = nil, headers = nil) 67: headers ||= {} 68: headers['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' 69: headers['HTTP_ACCEPT'] ||= [Mime::JS, Mime::HTML, Mime::XML, 'text/xml', Mime::ALL].join(', ') 70: process(request_method, path, parameters, headers) 71: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.