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?