Minitest::Rails::Assertions

Gem Version Build Status Code Climate Test Coverage

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

  1. Fork it ( https://github.com/[my-github-username]/minitest-rails-assertions/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request