ruby-on-rails - Guard 不会根据 spec/features/login_spec.rb 上的更改运行

标签 ruby-on-rails guard

我有一个带有文件 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/

相关文章:

ruby-on-rails - 如何使用 Arel 跨多态 has_one 关系进行查询

ruby-on-rails - ruby 中的动态配置文件

ruby-on-rails - rspec 使用 draper Decorator 测试 View

erlang - 一个 Erlang 保护序列,用于检查一个术语是否是一个长度 == n 的列表

css - Rails ERB 变量不响应 CSS

ruby-on-rails - 关闭 Firefox 中文本字段的自动完成功能

git - 红色、绿色和重构步骤之间的自动 git 提交?

erlang - 守卫没有捕获正确的数据

Swift guard 检查 nil 文件 - 意外发现 nil

vue.js - 如何防止用户在 Nuxt 中使用中间件离开页面?