2

After wondering why my specs do get run couple times after upgrading to guard 2.0.3 and guard-rspec 3.1.0 (running linux and vim) i could reproduce the strange behavior by creating a fresh barebones rails4-application, included

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

to the Gemfile

created a vanilla Guardfile:

bundle exec guard init

fired up guard:

bundle exec guard --debug

when changing a e.g. app/models/foobar.rb

the specs run three times:

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
[...] 

when simulating a file change with

$guard(main)> change app/models/foobar.rb

it runs - as expected - just once:

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
[...]

anybody is experiencing the same problems?

4

1 回答 1

2

我相信这是一个guard-rspec 问题。见:https ://github.com/guard/guard/issues/495

于 2013-10-09T13:42:37.717 回答