Class Camping::WebTest
In: lib/mosquito.rb
Parent: Test

Used to test the controllers and rendering. The test should be called <App>Test (BlogTest for the aplication called Blog). A number of helper instance variables will be created for you - @request, which will contain a Mosquito::MockRequest object, @response (contains the response with headers and body), @cookies (a hash) and @state (a hash). Request and response will be reset in each test.

Methods

Public Instance methods

Assert that a cookie of name matches a certain pattern

Check that the text in the body matches a regexp

Make sure that we are redirected to a certain URL. It‘s not needed to prepend the URL with a mount (instead of "/blog/latest-news" you can use "/latest-news")

Checks both the response status and the url.

Assert a specific response (:success, :error or a freeform error code as integer)

Checks that Camping sent us a cookie to attach a session

Gives you access to the instance variables assigned by the controller

Send a DELETE request to a URL. All requests except GET will allow setting verbatim request body as the third argument instead of a hash.

Nothing is new under the sun

Send a GET request to a URL

Send a POST request to a URL. All requests except GET will allow setting verbatim request body as the third argument instead of a hash.

Send a PUT request to a URL. All requests except GET will allow setting verbatim request body as the third argument instead of a hash.

Send the request. We will try to guess what you meant - if there are uploads to be processed it‘s not going to be a GET, that‘s for sure.

Quickly gives you a handle to a file with random content

[Validate]