警卫三次运行规格

时间:2013-10-09 11:54:56

标签: ruby-on-rails rspec rspec2 guard

在想知道为什么我的规格在升级到 guard 2.0.3 guard-rspec 3.1.0 之后会运行几次 (运行linux和vim) 我可以通过创建一个新的准系统rails4应用程序来重现这种奇怪的行为,包括

  • gem'rspec-rails'
  • gem'guard'
  • gem'guard-rspec'

到Gemfile

创建了一个vanilla Guardfile:

bundle exec guard init

警告:

bundle exec guard --debug

更改例如应用程序/模型/ foobar.rb

规格运行三次:

13:27:58 - DEBUG - Trying to run Guard::RSpec#run_on_additions with ["spec/models/foobar_spec.rb"] 
13:27:58 - DEBUG - Hook :run_on_changes_begin executed for#  
[...] 
13:27:58 - INFO - Running: spec/models/foobar_spec.rb
[...] 
13:28:00 - DEBUG - Trying to run Guard::RSpec#run_on_removals with ["spec/models/foobar_spec.rb"] 
13:28:00 - DEBUG - Hook :run_on_changes_begin executed for # 
[...] 
13:28:00 - INFO - Running: spec/models/foobar_spec.rb
[...] 
13:28:01 - DEBUG - Trying to run Guard::RSpec#run_on_modifications with ["spec/models/foobar_spec.rb"] 
13:28:01 - DEBUG - Hook :run_on_changes_begin executed for # 
[...] 
13:28:01 - INFO - Running: spec/models/foobar_spec.rb
[...] 

使用

模拟文件更改时

$防护件(主)GT;更改app / models / foobar.rb

它运行 - 正如预期的那样 - 只运行一次:

13:48:52 - DEBUG - Trying to run Guard::RSpec#run_on_modifications with ["spec/models/foobar_spec.rb"]
13:48:52 - DEBUG - Hook :run_on_changes_begin executed for #
[...]
13:48:52 - INFO - Running: spec/models/foobar_spec.rb
[...]

有人遇到同样的问题吗?

1 个答案:

答案 0 :(得分:2)

我认为这是一个警卫问题。请参阅:https://github.com/guard/guard/issues/495