5

我有一个带有文件的 Rails 3.2 应用程序spec/features/login_spec.rb。我正在尝试(没有运气)让 Guard 在此文件更改时运行。

这是我的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

当我更改spec/models/, 或中的文件时spec/support/,它会获取更改并重新运行。它只是spec/features/' that's no good. It doesn't seem to be Rspec's fault, as runningrspec` 运行这些文件(因此在 Guard 控制台中按 [enter] 也是如此)。

而且,当我将文件名更改为除 之外的任何内容(嗯,我尝试过的任何内容)login_spec.rb时,它都会被拾取。

那么为什么 Guard 不喜欢这个文件名呢?任何帮助将不胜感激。

4

1 回答 1

4

看起来这是 Guard 中的一个错误,已于 2013 年 10 月 9 日修复。

于 2013-10-10T21:43:50.227 回答