diff --git a/Gemfile b/Gemfile index fe458104..055547e4 100644 --- a/Gemfile +++ b/Gemfile @@ -35,3 +35,6 @@ end gem "rails", rails gem "mongoid", mongoid if mongoid gem "devise", devise if devise + +gem 'guard-rspec' +gem 'rb-fsevent' diff --git a/Guardfile b/Guardfile index 851bbbee..2e6c3d74 100644 --- a/Guardfile +++ b/Guardfile @@ -1,4 +1,25 @@ -guard 'rspec', :version => 2, :notification => false do +def rspec_guard(options = {}, &block) + options = { + :version => 2, + :notification => false + }.merge(options) + + guard 'rspec', options, &block +end + +rspec_guard :spec_paths => %w{spec/draper spec/generators} do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } +end + +rspec_guard :spec_paths => 'spec/integration', :env => {'RAILS_ENV' => 'development'} do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } +end + +rspec_guard :spec_paths => 'spec/integration', :env => {'RAILS_ENV' => 'production'} do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" }