Skip to content
thibaudgg edited this page Nov 8, 2010 · 14 revisions

Typical Rails Guardfile with RSpec

guard 'bundler' do
  watch('^Gemfile')
end

guard 'passenger', :standalone => true do
  watch('lib/.*\.rb')
  watch('config/.*\.rb')
end

guard 'livereload' do
  watch('^app/.+\.(erb|haml)$')
  watch('^app/helpers/.+\.rb$')
  watch('^/public/.+\.(css|js|html)$')
  watch('^config/locales/.+\.ym$')
end

guard 'rspec', :version => 2, :bundler => false, :formatter => "instafail" do
  watch('^spec/(.*)_spec.rb')
  watch('^app/(.*)\.rb')                              { |m| "spec/#{m[1]}_spec.rb" }
  watch('^lib/(.*)\.rb')                              { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('^config/routes.rb')                          { "spec/routing" }
  watch('^app/controllers/application_controller.rb') { "spec/controllers" }
  watch('^spec/support/controller_spec_helpers.rb')   { "spec/controllers" }
  watch('^spec/factories.rb')                         { "spec/models" }
  watch('^spec/spec_helper.rb')                       { "spec" }
end

Clone this wiki locally