Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
MiniTest extension for Rails
Ruby
branch: master

This branch is 14 commits ahead, 318 commits behind blowmage:master

Override #determine_default_controller_class in MiniTest::Rails::Cont…

…roller to allow controller class arguments and nested describe blocks
latest commit 79386bb386
@kamui kamui authored committed

README.rdoc

minitest-rails

MiniTest integration for Rails 3.1.

Install

gem install minitest-rails

This installs the following gems:

minitest

Configure

Create a new rails app without Test::Unit:

rails new MyApp --skip-test-unit

Add minitest-rails to the :test and :development groups in Gemfile:

group :test, :development do
  gem 'minitest-rails'
end

Or, for the truly enlightened, add minitest-rails to the :test and :development groups in Isolate:

env :development, :test do
  gem 'minitest-rails'
end

Next run the installation generator with the following:

rails generate mini_test:install

This will add the minitest_helper.rb file to the test directory.

Usage

We aim to expose MiniTest with minimal changes for testing within Rails. Your test classes will inherit from MiniTest::Rails::Spec (or Model, or Controller, etc) and you can use the MiniTest::Spec DSL. You can generate test files with the standard model, controller, scaffold, and other generators:

rails generate model User

And you can specify generating the tests using the MiniTest::Spec DSL on any of the generators by providing the --spec option:

rails generate model User --spec

And you can specify generating the fixture for a model by providing the --fixture option:

rails generate model User --fixture

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

config.generators do |g|
  g.test_framework :mini_test, :spec => true, :fixture => true
end
Something went wrong with that request. Please try again.