Minitest guard allows to automatically & intelligently launch tests with minitest framework when files are modified.
- Compatible with MiniTest 1.7.x & 2.x
- Tested on Ruby 1.8.7, 1.9.2 & 1.9.3
Please be sure to have Guard installed before continue.
Install the gem:
gem install guard-minitest
Add it to your Gemfile (inside test group):
gem 'guard-minitest'
Add guard definition to your Guardfile by running this command:
guard init minitest
Please read Guard usage doc
Minitest guard can be really adapated to all kind of projects. Please read {guard doc}[http://github.com/guard/guard#readme] for more info about Guardfile DSL.
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
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
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}[https://github.com/sporkrb/spork-testunit] you can enable it with (you'll have to load it before):
guard 'minitest', :drb => true do
# ...
end
:notify => false # disable desktop notifications
: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
- Source hosted on GitHub
- Report issues/Questions/Feature requests on GitHub Issues
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.