Skip to content

Instantly share code, notes, and snippets.

@dgoldie
Forked from Emerson/Guardfile
Last active December 25, 2015 08:29
Show Gist options
  • Save dgoldie/6947433 to your computer and use it in GitHub Desktop.
Save dgoldie/6947433 to your computer and use it in GitHub Desktop.
guard 'minitest' do
# with Minitest::Unit
watch(%r|^test/(.*)\/?test_(.*)\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r|^test/test_helper\.rb|) { "test" }
# Rails 4 - App Files
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r|^app/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}_test.rb" }
watch(%r|^app/models/(.*)\.rb|) { |m| "test/models/#{m[1]}_test.rb" }
# Rails 4 - Test Files
watch(%r|^test/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}.rb" }
watch(%r|^test/helpers/(.*)\.rb|) { |m| "test/helpers/#{m[1]}.rb" }
watch(%r|^test/integration/(.*)\.rb|) { |m| "test/integration/#{m[1]}.rb" }
watch(%r|^test/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}.rb" }
watch(%r|^test/models/(.*)\.rb|) { |m| "test/models/#{m[1]}.rb" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment