|
| 1 | +# A sample Guardfile |
| 2 | +# More info at https://github.com/guard/guard#readme |
| 3 | + |
| 4 | +## Uncomment and set this to only include directories you want to watch |
| 5 | +# directories %w(app lib config test spec features) \ |
| 6 | +# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")} |
| 7 | + |
| 8 | +## Note: if you are using the `directories` clause above and you are not |
| 9 | +## watching the project directory ('.'), then you will want to move |
| 10 | +## the Guardfile to a watched dir and symlink it back, e.g. |
| 11 | +# |
| 12 | +# $ mkdir config |
| 13 | +# $ mv Guardfile config/ |
| 14 | +# $ ln -s config/Guardfile . |
| 15 | +# |
| 16 | +# and, you'll have to watch "config/Guardfile" instead of "Guardfile" |
| 17 | + |
| 18 | +guard :minitest, all_after_pass: true do |
| 19 | + # with Minitest::Unit |
| 20 | + watch(%r{^test/(.*)\/?test_(.*)\.rb$}) |
| 21 | + watch(%r{^test/(.*)\/?(.*)_test\.rb$}) |
| 22 | + watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" } |
| 23 | + watch(%r{^test/test_helper\.rb$}) { 'test' } |
| 24 | + |
| 25 | + # with Minitest::Spec |
| 26 | + # watch(%r{^spec/(.*)_spec\.rb$}) |
| 27 | + # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } |
| 28 | + # watch(%r{^spec/spec_helper\.rb$}) { 'spec' } |
| 29 | + |
| 30 | + # Rails 4 |
| 31 | + # watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } |
| 32 | + # watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' } |
| 33 | + # watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" } |
| 34 | + # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" } |
| 35 | + # watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" } |
| 36 | + # watch(%r{^test/.+_test\.rb$}) |
| 37 | + # watch(%r{^test/test_helper\.rb$}) { 'test' } |
| 38 | + |
| 39 | + # Rails < 4 |
| 40 | + # watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" } |
| 41 | + # watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" } |
| 42 | + # watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" } |
| 43 | +end |
0 commit comments