Module

TestResponseBehavior

A refactoring of TestResponse to allow the same behavior to be applied to the "real" CgiResponse class in integration tests.

Public Methods
binary_content Returns binary content (downloadable file), converted to a String
code returns a String to ensure compatibility with Net::HTTPResponse
cookies Returns the response cookies, converted to a Hash of (name => CGI::Cookie) pairs Example:
error? was there a server-side error?
flash a shortcut to the flash (or an empty hash if no flash.. hey! that rhymes!)
has_flash? do we have a flash?
has_flash_object? does the specified flash object exist?
has_flash_with_contents? do we have a flash that has contents?
has_session_object? does the specified object exist in the session?
has_template_object? does the specified template object exist?
message
missing? was the URL not found?
redirect? were we redirected?
redirect_url returns the redirection location or nil
redirect_url_match? does the redirect location match this regexp pattern?
rendered_file returns the template path of the file which was used to render this response (or nil)
rendered_with_file? was this template rendered by a file?
response_code the response code of the request
server_error? Alias for #error?
success? was the response successful?
template_objects a shortcut to the template.assigns
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.