rack-minitest
rack-minitest
= rack-test
+ MiniTest
. See what I did there?
This gem adds some convenience methods to rack-test
and MiniTest
that I found myself duplicating over and over for every application I wrote. It adds a few methods for dealing with JSON to rack-test
and MiniTest
spec-style matchers for checking response status. The specific methods are:
last_json_response
get_json path, params
post_json path, params
put_json path, params
delete_json path, params
last_response.must_be_ok
last_response.must_be_created
last_response.must_be_no_content
last_response.must_be_moved_permanently
last_response.must_be_bad_request
last_response.
last_response.must_be_forbidden
last_response.must_be_not_found
last_response.must_be_unprocessable_entity
last_response.must_be_internal_server_error
NB: This is a quick and dirty gem to hack in some functionality that I was surprised to find didn't already exist. There are tests, and they pass, but they're pretty gross. All improvements are welcome.
Installation
Add this line to your application's Gemfile:
gem "rack-minitest", git: "git://github.com/brandonweiss/rack-minitest.git"
And then execute:
$ bundle
Usage
Just add the appropriate requires after you load rack-test
and MiniTest
.
require "rack-minitest/assertions"
require "rack-minitest/spec"
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request