Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Guard::Minitest automatically run your tests (much like autotest)
Ruby

This branch is 242 commits behind guard:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
gemfiles
lib/guard
spec
test/guard
.gitignore
.travis.yml
CHANGELOG.md
Gemfile
Guardfile
LICENSE
README.md
Rakefile
guard-minitest.gemspec

README.md

Guard::Minitest Build Status

Guard::Minitest allows to automatically & intelligently launch tests with the minitest framework when files are modified.

  • Compatible with minitest 1.7.x & 2.x.
  • Tested against Ruby 1.8.7, 1.9.2, 1.9.3, Ruby HEAD, REE and the latest versions of JRuby.

Install

Please be sure to have Guard installed before continue.

The simplest way to install Guard::Minitest is to use Bundler.

Add Guard::Minitest to your Gemfile:

group :development do
  gem 'guard-minitest'
end

and install it by running Bundler:

$ bundle

Add guard definition to your Guardfile by running the following command:

guard init minitest

Usage

Please read Guard usage doc

Guardfile

Guard::Minitest can be really adapated to all kind of projects. Please read guard doc for more info about Guardfile DSL.

Standard Guardfile when using Minitest::Unit

guard 'minitest' do
  watch(%r|^test/test_(.*)\.rb|)
  watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
  watch(%r|^test/test_helper\.rb|)   { "test" }
end

Standard Guardfile when using Minitest::Spec

guard 'minitest' do
  watch(%r|^spec/(.*)_spec\.rb|)
  watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  watch(%r|^spec/spec_helper\.rb|)   { "spec" }
end

Options

You can change the default location and pattern of minitest files:

guard 'minitest', test_folders: 'test/unit', test_file_patterns: '*_test.rb' do
  # ...
end

You can pass any of the standard MiniTest CLI options using the :cli option:

guard 'minitest', :cli => "--seed 123456 --verbose" do
  # ...
end

If you use spork-testunit you can enable it with (you'll have to load it before):

guard 'minitest', :drb => true do
  # ...
end

List of available options:

:cli => '--test'            # pass arbitrary Minitest CLI arguments, default: ''
:bundler => false           # don't use "bundle exec" to run the minitest command, default: true
:rubygems => true           # require rubygems when run the minitest command (only if bundler is disabled), default: false
:drb => true                # enable DRb support, default: false
:test_folders => ['tests']  # specify an array of paths that contain test files, default: %w[test spec]
:test_file_patterns => true # specify an array of patterns that test files must match in order to be run, default: %w[*_test.rb test_*.rb *_spec.rb]
:all_on_start => false      # run all tests in group on startup, default: true

Development

Pull requests are very welcome! Please try to follow these simple rules if applicable:

  • Please create a topic branch for every separate change you make.
  • Make sure your patches are well tested. All specs run by Travis CI must pass.
  • Update the README.
  • Please do not change the version number.

For questions please join us in our Google group or on #guard (irc.freenode.net).

Author

Yann Lugrin

Something went wrong with that request. Please try again.