I'm running Guard with rspec 3.0 and spring on Rails 4.1. When I try to write view specs for my app, guard isn't noticing the correct file being saved. For example, if I save a view spec at "/spec/views/api/v1/registrations/create.json.jbuilder_spec.rb", guard will run the spec for "/spec/controllers/api/v1/registrations_controller_spec.rb". My Guardfile is below:
guard :rspec, cmd: 'spring rspec', all_on_start: false do
watch(%r{^spec/models/.+integration_spec\.rb$})
watch(%r{^spec/helpers/.+_spec\.rb$})
watch(%r{^spec/routing/.+_spec\.rb$})
watch(%r{^spec/requests/.+_spec\.rb$})
watch(%r{^spec/views/.+_spec\.rb$})
watch(%r{^spec/controllers/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
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('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
end
If I comment out all of the "spec" regular expressions except for the view one, guard still has the same behaviour that I explained above. Also, this happens for every single view spec that I write. I'm not sure why this regular expression is picking this up, but any help is appreciated.