DESCRIPTION

Plack::Test::Simple is a collection of testing helpers for anyone developing Plack applications. This module is a wrapper around Plack::Test providing a unified interface to test PSGI applications using HTTP::Request and HTTP::Response objects. Typically a Plack web application's deployment stack includes various middlewares and utilities which are now even easier to test along-side the actual web application code.

ATTRIBUTES

request

The request attribute contains the HTTP::Request object which will be used to process the HTTP requests. This attribute is never reset.

psgi

The psgi attribute contains a coderef containing the PSGI compliant application code. If this value is a string containing the path to the psgi file, the application code will be coerced.

METHODS

transaction

The transaction method returns a Plack::Test::Simple::Transaction object containing the HTTP request and response object that will be used to facilitate the HTTP transaction. The actually HTTP request is deferred until the response object is needed, this allows you to further modify the transactions HTTP request object before it is processed. This method optionally accepts an HTTP request method, a request path (or URI object), and content (any string) you wish to place in the body of the request. If the content body argument is a hash/array reference, we will attempt to encode and serialize it automatically as a JSON object. These parameters are used to further modify the transaction's request object. Please see Plack::Test::Simple::Transaction for more information on how to use the transaction object to further automate tests.

connect_returns_CODE

The connect_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

delete_returns_CODE

The delete_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

get_returns_CODE

The get_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

head_returns_CODE

The head_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

options_returns_CODE

The options_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

patch_returns_CODE

The patch_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

post_returns_CODE

The post_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

put_returns_CODE

The put_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.

trace_returns_CODE

The trace_returns_CODE method is a shorthand method for returning a transaction object much like the transaction method except the the actual HTTP request is made and the server's HTTP response code is tested to ensure it returns a CODE. The CODE in this method description is a variable which represents any valid HTTP response code, e.g. 200.