An integration Session instance represents a set of requests and responses performed sequentially by some virtual user. Becase you can instantiate multiple sessions and run them side-by-side, you can also mimic (to some limited extent) multiple simultaneous users interacting with your system.

Typically, you will instantiate a new session using IntegrationTest#open_session, rather than instantiating Integration::Session directly.

Classes
StubCGI
Public Attributes
accept The Accept header to send.
controller A reference to the controller instance used by the last request.
cookies A map of the cookies returned by the last response, and which will be sent with the next request.
headers A map of the headers returned by the last response.
host The hostname used in the last request.
path The URI of the last request.
remote_addr The remote_addr used in the last request.
request A reference to the request instance used by the last request.
request_count A running counter of the number of requests processed.
response A reference to the response instance used by the last request.
status The integer HTTP status code of the last request.
status_message The status message that accompanied the status code of the last request.
Public Methods
delete Performs a DELETE request with the given parameters. See get() for more details.
delete_via_redirect Performs a DELETE request, following any subsequent redirect. See #request_via_redirect() for more information.
follow_redirect! 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.
get Performs a GET request with the given parameters. The parameters may be nil, a Hash, or a string that is appropriately encoded (application/x-www-form-urlencoded or multipart/form-data). The headers should be a hash. The keys will automatically be upcased, with the prefix ‘HTTP_’ added if needed.
get_via_redirect Performs a GET request, following any subsequent redirect. See #request_via_redirect() for more information.
head Performs a HEAD request with the given parameters. See get() for more details.
host! Set the host name to use in the next request.
https! Specify whether or not the session should mimic a secure HTTPS request.
https? Return true if the session is mimicing a secure HTTPS request.
new Create and initialize a new Session instance.
post Performs a POST request with the given parameters. See get() for more details.
post_via_redirect Performs a POST request, following any subsequent redirect. See #request_via_redirect() for more information.
put Performs a PUT request with the given parameters. See get() for more details.
put_via_redirect Performs a PUT request, following any subsequent redirect. See #request_via_redirect() for more information.
redirect? Returns true if the last response was a redirect.
request_via_redirect 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.
reset! Resets the instance. This can be used to reset the state information in an existing session instance, so it can be used from a clean-slate condition.
url_for Returns the URL for the given options, according to the rules specified in the application’s routes.
xhr Alias for #xml_http_request
xml_http_request Performs an XMLHttpRequest request with the given parameters, mirroring a request from the Prototype library.
Private Methods
encode_cookies Encode the cookies hash in a format suitable for passing to a request.
generic_url_rewriter Get a temporary URL writer object
interpret_uri Tailors the session based on the given URI, setting the HTTPS value and the hostname.
name_with_prefix
parse_result Parses the result of the response and extracts the various values, like cookies, status, headers, etc.
process Performs the actual request.
requestify Convert the given parameters to a request string. The parameters may be a string, nil, or a Hash.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.