disu.se

SessionClass

Namespace

Lookout::Rack

Ancestors
  1. Object

A Rack session for use with Lookout. Given a Rack “app”, it’ll allow you to make #get, #post, #put, and #delete requests (and actually #dispatch arbitrary requests, if you desire), check the sent #request, check the received #response, follow #redirect!s, add #cookies, and #clear cookies.

Constructor

initialize(app#call)#

Sets up a new session for app. You’ll most likely not call this yourself, leaving it up to Methods#session to do so.

Instance Methods

get(uriString, paramsHash = {}, envHash = {})self#

Dispatches a GET request.

post(uriString, paramsHash = {}, envHash = {})self#

Dispatches a POST request.

put(uriString, paramsHash = {}, envHash = {})self#

Dispatches a PUT request.

delete(uriString, paramsHash = {}, envHash = {})self#

Dispatches a DELETE request.

dispatch(methodString, uriString = '', paramsHash = {}, envHash = {})self#

Dispatches a method #request to uri with params in env and gets its #response, storing any returned #cookies. For more information on env, see Rack::MockRequest.

requestRack::Request#

Returns the Rack request that was most recently sent during this session.

RaisesRequestError

If no request has been sent yet

responseRack::MockResponse#

Returns the Rack response that was most recently received during this session.

RaisesRequestError

If no response has been received yet

redirect!self#

Redirects to the most recent response’s redirected location by performing a #get request to the “Location” header of the response.

Raises
RequestError

If no response has been received yet

RedirectError

If the last response wasn’t a redirect

clearself#

Clears all cookies from the session.