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/patch/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/patch/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 head new options parse_uri_rfc2396 patch post put request

### Classes and Modules

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

### Constants

DEFAULT_ENV | = | { "rack.version" => Rack::VERSION, "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)
parse_uri_rfc2396(uri)

For historical reasons, we‘re pinning to RFC 2396. It‘s easier for users and we get support from ruby 1.8 to 2.2 using this method.

### Public Instance methods

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

[Validate]