Class

Rack::MockRequest

Inheritance
< Object

Rack::MockRequest helps testing your Rack application without actually using HTTP.

After performing a request on a URL with get/post/put/delete, it returns a MockResponse with useful helper methods for effective testing.

You can pass a hash with additional configuration to the get/post/put/delete.

:input:A String or IO-like to be used as rack.input.
:fatal:Raise a FatalWarning if the app writes to rack.errors.
:lint:If true, wrap the application in a Rack::Lint.

Classes & Modules

Constants

Name   Description
DEFAULT_ENV = { "rack.version" => [0,1], "rack.input" => StringIO.new, "rack.errors" => StringIO.new, "rack.multithread" => true, "rack.multiprocess" => true, "rack.run_once" => false, }

Methods

Class

Visibility Signature
public env_for (uri="", opts={})
public new (app)

Instance

Visibility Signature
public delete (uri, opts={})
public get (uri, opts={})
public post (uri, opts={})
public put (uri, opts={})
public request (method="GET", uri="", opts={})

Class Method Detail

env_for(uri="", opts={})

Return the Rack environment used for a request to uri.

new(app)

Instance Method Detail

delete(uri, opts={})

get(uri, opts={})

post(uri, opts={})

put(uri, opts={})

request(method="GET", uri="", opts={})