I have a Rails 3.2 app with a file spec/features/login_spec.rb
. I'm trying – without luck – to get Guard to run when this file is changed.
Here's my Guardfile
:
guard :rspec do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch(%r{^spec/factories/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
end
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch('config/environments/test.rb')
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
end
When I change files in spec/models/
, or spec/support/
, it picks up the changes and re-runs. It's just spec/features/' that's no good. It doesn't seem to be Rspec's fault, as running
rspec` runs those files (and thus so does hitting [enter] in the Guard console).
And when I change the name of the file to anything (well, anything I've tried) besides login_spec.rb
, it gets picked up.
So why does Guard have a dislike for this filename? Any help would be greatly appreciated.
Looks like it was a bug in Guard that was fixed 9 Oct 2013.