GithubHelp home page GithubHelp logo

blakewilliams / minitest-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from minitest/minitest-rails

0.0 3.0 0.0 620 KB

MiniTest integration for Rails 3 and 4

Home Page: http://blowmage.com/minitest-rails

License: MIT License

Ruby 100.00%

minitest-rails's Introduction

minitest-rails

MiniTest integration for Rails 3 and 4

<img src=“https://secure.travis-ci.org/blowmage/minitest-rails.png” alt=“Build Status” /> <img src=“https://codeclimate.com/badge.png” />

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 Gemfile:

gem "minitest-rails"

Next run the installation generator with the following:

rails generate mini_test:install

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

Usage

This project aims to enable MiniTest within the Rails TestCase classes. Your test will continue to inherit from ActiveSupport::TestCase, which will now support the spec DSL. You can generate test files with the standard model, controller, resource, 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 not generating the fixture for a model by providing the --skip-fixture option:

rails generate model User --skip-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 => false
end

To run your tests, minitest-rails provides multiple rake tasks by default, for a complete list, simply run rake -T.

You can also add any directories under test/ and minitest-rails will automatically create the associated rake task for it. So let say you add a test/api/ directory, rake minitest:api will automagically be available.

If you want to automatically run rake minitest:api when you call rake minitest, add this line to a new .rake file under lib/tasks/:

MiniTest::Rails::Testing.default_tasks << 'api'

Running on Ruby 1.8

Efforts have been made to be compatible with Ruby 1.8.7, but some rough edges may remain. For the latest information on 1.8 compatibility see the wiki: github.com/blowmage/minitest-rails/wiki/Running-on-1.8

Capybara

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

Upgrading

The 0.9 release marks a new direction for minitest-rails. Deprecations have been added for the features that won’t make it to 1.0. See instructions for upgrading to 0.9: github.com/blowmage/minitest-rails/wiki/Upgrading-to-0.9

Incompatibilities

Existing tests that call describe will not work, since describe is used by MiniTest::Spec blocks.

Get Involved

Join the mailing list to get help or offer suggestions.

groups.google.com/group/minitest-rails

License

Copyright © 2013 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.

minitest-rails's People

Contributors

agirorn avatar allaire avatar blakewilliams avatar blowmage avatar bobbus avatar floehopper avatar gma avatar haines avatar masa-iwasaki avatar montague avatar mschuerig avatar phiggins avatar rafadc avatar ream88 avatar sauy7 avatar starpeak avatar vongruenigen avatar zesty avatar

Watchers

 avatar  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.