Skip to content

Instantly share code, notes, and snippets.

@bhuga
Created February 3, 2012 19:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhuga/1731900 to your computer and use it in GitHub Desktop.
Save bhuga/1731900 to your computer and use it in GitHub Desktop.
Can't believe this one took me so long to figure out.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment