Minitest::Rails::Assertions
The gem minitest-rails-assertions extends MiniTest to add some assertions for Rails specific methods.
Installation
Add this line to your application's Gemfile:
gem 'minitest-rails-assertions'
And then execute:
$ bundle
Or install it yourself as:
$ gem install minitest-rails-assertions
Usage
Add in your test_helper.rb
:
require 'minitest/rails/assertions'
Use the assertions like the Minitest assertion. For instance:
assert_length_of Product, :name, maximum: 30
assert_validates Product, :reference, format: { with: /\A\w\d{9}\z/i }, uniqueness: true
Contributing
- Fork it ( https://github.com/[my-github-username]/minitest-rails-assertions/fork )
- 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 a new Pull Request