Git Product home page Git Product logo

minitest-rails's Introduction

minitest-rails

Minitest integration for Rails 7.0

CI Code Climate

Install

gem install minitest-rails

This installs the following gems:

  • minitest

Configure

Create a new rails app:

rails new MyApp

Choosing a version

This gem follows the versioning of Rails. If you are running Rails 7.0, specify the corresponding 7.0 release in the Gemfile. For example:

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

If you are running Rails 6.x, specify the corresponding 6.x release in the Gemfile. For example, if you are using Rails 6.1 you will specify:

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

If you are running Rails 5.x, specify the corresponding 5.x release in the Gemfile. For example, if you are using Rails 5.2 you will specify:

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

Or, if you prefer to run the previous release for Rails 5.x, specify the 3.x release in the Gemfile:

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

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

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

If you are running Rails 4.0 or earlier, you really need to upgrade. But if you are you need to specify the 1.x release in the Gemfile:

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

Installing

Next run the installation generator with the following:

rails generate minitest: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 using the Minitest::Spec DSL with the standard model, controller, resource, and other generators:

rails generate model User

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

rails generate model User --no-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 :minitest, spec: false, fixture: false
end

Running Tests

To run your tests use the rails test that ship with rails.

Get Involved

Join the mailing list to get help or offer suggestions.

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

License

Copyright (c) 2019 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

asgerb avatar blowmage avatar fabiolnm avatar grosser avatar jesperronn avatar mauricebolhuis avatar shockwavenn avatar zenspider 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.