public
Last active

Can't believe this one took me so long to figure out.

  • Download Gist
Guardfile
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('Gemfile.lock')
watch('spec/spec_helper.rb')
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch(%r{^spec/support/.+\.rb$})
watch(%r{^spec/factories/.+\.rb$})
# watch(%r{^spec/factories/.+\.rb$}) # Uncomment when you have a large amount of factories
# watch(%r{^spec/fabricators/.+\.rb$}) # Uncomment when you have a large amount of fabricators
end
 
guard 'rspec', version: 2, cli: '--drb --color --format documentation', all_on_start: false, all_after_pass: false do
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^lib/decorators/(.+)_decorator\.rb$}) { |m| "spec/models/#{m[1]}_spec.rb" }
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb" ] }
watch('spec/spec_helper.rb')
watch(%r{^spec/support/.+\.rb$})
watch(%r{^spec/((?!requests).)+_spec\.rb$})
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch(%r{^spec/fabricators/(.+)_fabricator\.rb$}) { |m| "spec/models/#{m[2]}_spec.rb" }
watch(%r{^spec/factories/(.+)_factory\.rb$}) { |m| "spec/models/#{m[2]}_spec.rb" }
end
 
guard 'rspec', version: 2, cli: '--color --format documentation', all_on_start: false, all_after_pass: false do
# spork and capybara do not get along. watch capybara specs in a non-drb guard.
watch(%r{^spec/(.*requests.*)_spec\.rb$})
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/requests/#{m[1]}_page_spec.rb" ] }
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.