Created
March 12, 2013 03:51
-
-
Save Emerson/5140181 to your computer and use it in GitHub Desktop.
Example Guard File for Rails 4 and Minitest::Unit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/unit/#{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 |
You may have a typo on line 11. Should be
watch(%r|^app/models/(.*)\.rb|) { |m| "test/models/#{m[1]}_test.rb" }
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works on my machine with
gem 'guard' gem 'guard-minitest'