Class: Rack::MockRequest

Class | Rack::MockRequest
In: | lib/rack/mock.rb
Parent: | 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.

### Methods

delete env_for get new post put request

### Classes and Modules

Class Rack::MockRequest::FatalWarner
Class Rack::MockRequest::FatalWarning

### Constants

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

### Public Class methods

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

Return the Rack environment used for a request to `uri`.

new(app)

### Public Instance methods

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

[Validate]