Question

After upgrading to guard 2.6.1 guard stopped executing specs for changed file

13:27:09 - INFO - LiveReload is waiting for a browser to connect. 
13:27:09 - INFO - Guard::RSpec is running 
13:27:09 - INFO - Guard is now watching at '[path to project]'
13:27:13 - INFO - Running: spec/models/[some_model]_spec.rb
13:27:13 - ERROR - No cmd option specified, unable to run specs!

My bundle is

Using guard (2.6.1)
Using guard-livereload (2.3.0)
Using guard-rails (0.5.3)
Using guard-rspec (4.3.1)

Using rspec-core (2.14.8)
Using rspec-expectations (2.14.5)
Using rspec-mocks (2.14.6)
Using rspec (2.14.1)
Using rspec-rails (2.14.2)
Using rails (4.0.4)
Was it helpful?

Solution

You need to update your Guardfile and add the cmd option.

Guard::RSpec 4.0 now uses a simpler approach with the new cmd option that let you precisely define which rspec command will be launched on each run. This option is required due to the number of different ways possible to invoke rspec, the template now includes a default that should work for most applications but may not be optimal for all.

This is how looks my Guardfile:

guard :rspec, cmd: "bundle exec rspec" do
  # ...
end

OTHER TIPS

Alternative answer in case of using Zeus to speed up test execution

guard 'rspec', cmd: "zeus test" do
  #
end

Make sure you start Zeus before using Guard

> zeus start
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top