= minitest-rails

Minitest integration for Rails 5

{<img src="https://secure.travis-ci.org/blowmage/minitest-rails.png" alt="Build Status" />}[http://travis-ci.org/blowmage/minitest-rails]
{<img src="https://codeclimate.com/github/blowmage/minitest-rails.png" />}[https://codeclimate.com/github/blowmage/minitest-rails]
{<img src="https://badges.gitter.im/Join Chat.svg" />}[https://gitter.im/blowmage/minitest-rails]

== Install

    gem install minitest-rails

This installs the following gems:

    minitest

== Configure

Create a new rails app:

    rails new MyApp

Add <tt>minitest-rails</tt> to the Gemfile:

    gem "minitest-rails"

If you are running Rails 4.1 or 4.2, be sure to specify a 2.x release in the Gemfile:

    gem "minitest-rails", "~> 1.0"

If you are running Rails 4.0 or earlier, be sure to specify a 1.x release in the Gemfile:

    gem "minitest-rails", "~> 1.0"

Next run the installation generator with the following:

    rails generate minitest:install

This will add the <tt>test_helper.rb</tt> file to the <tt>test</tt> directory.

== Usage

This project aims to enable Minitest within the Rails TestCase classes.
Your test will continue to inherit from <tt>ActiveSupport::TestCase</tt>, which will now support the spec DSL.
You can generate test files using the <tt>Minitest::Spec</tt> DSL with the standard model, controller, resource, and other generators:

    rails generate model User

And you can specify generating the tests without the <tt>Minitest::Spec</tt> DSL on any of the generators by providing the <tt>--no-spec</tt> option:

    rails generate model User --no-spec

And you can specify not generating the fixture for a model by providing the <tt>--skip-fixture</tt> option:

    rails generate model User --skip-fixture

You can also set these as defaults by adding the following to the <tt>config/application.rb</tt> file:

    config.generators do |g|
      g.test_framework :minitest, spec: false, fixture: false
    end

== Running Tests

To run your tests use the <tt>rails test</tt> that ship with rails.

== Using Rails 4.1 or 4.2

For information on using minitest-rails with Rails 4.1 and 4.2, see the README for the 2.x branch: https://github.com/blowmage/minitest-rails/tree/2.x#readme

== Using Rails 4.0 or earlier

For information on using minitest-rails with Rails 3.0 through 4.0, see the README for the 1.x branch: https://github.com/blowmage/minitest-rails/tree/1.x#readme

== Capybara

You can use Capybara for feature tests by adding <tt>minitest-rails-capybara</tt> as a dependency. See the README for more information: https://github.com/blowmage/minitest-rails-capybara

== Get Involved

Join the mailing list to get help or offer suggestions.

https://groups.google.com/group/minitest-rails

Or join the discussion on Gitter.

https://gitter.im/blowmage/minitest-rails

== License

Copyright (c) 2014 Mike Moore

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
