我有一个带有文件 spec/features/login_spec.rb
的 Rails 3.2 应用程序.我正在尝试 - 运气不好 - 在更改此文件时让 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 running
rspec` 运行这些文件(因此在 Guard 控制台中按 [enter] 也是如此)。当我将文件名更改为除
login_spec.rb
之外的任何内容(好吧,我尝试过的任何内容)时,它被拾起。那么为什么 Guard 不喜欢这个文件名呢?任何帮助将不胜感激。
最佳答案
看起来是 bug在 2013 年 10 月 9 日修复的 Guard 中。
关于ruby-on-rails - Guard 不会根据 spec/features/login_spec.rb 上的更改运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19306555/