Git Product home page Git Product logo

minitest-rails's Introduction

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

minitest-rails's People

Contributors

blowmage avatar phiggins avatar

Watchers

Graham Ashton avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.