Search code examples
ruby-on-railsunit-testingsporkguardgrowl

Growl with guard and spork fails silently on OS 10.6.6


I get no Growl notifications when tests pass or fail. I've gone through all the setup guides I can find.

Details

I run guard and it starts Spork fine:

Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!

When I change a spec file, everything seems OK:

Running: spec/unit/category_spec.rb
Running tests with args ["--color", "--format", "progress", "--format", "Guard::RSpec::Formatter::NotificationRSpec", "--out", "/dev/null", "--require", "/Users/John/.rvm/gems/ruby-1.9.2-p290/gems/guard-rspec-0.5.2/lib/guard/rspec/formatters/notification_rspec.rb", "spec/unit/category_spec.rb"]...
.

Finished in 0.2063 seconds
1 example, 0 failures
Done.

But... nothing from Growl.

What I've Tried

  • Ticked Guard in the Applications tab in Growl pref pane
  • Installed latest Growl for Snow Leopard - V1.2.2
  • Growl is started and working OK - I enable iTerm and I get notifications from that fine.
  • Added rb-fsevent, growl and growl_notify to gem file and ran bundle install
  • Installed Growl Notify package from the Growl Downloads page.
  • Restarted my Mac

Gemfile

group :development, :test do
  gem 'factory_girl'
  gem 'rspec-rails'
  gem "guard-rspec"
  gem "spork", "> 0.9.0.rc"
  gem "guard-spork"
  gem 'rb-fsevent'
  gem 'growl_notify'
  gem 'growl'
end

Update

By complete chance I found that when I removed the --drb option from the guard file:

Before:

guard 'rspec', :version => 2, :cli => "--drb"  do

After:

guard 'rspec', :version => 2, :cli => ""  do

Growl started working. But when I do this, the tests take ages to run again.

Growl works OR tests are fast ...but not both!


Solution

  • Finally, the penny dropped, completely by accident.

    I had the following line in my Guardfile:

    guard 'rspec', :version => 2, :cli => "--drb" do
        ....
    end
    

    The problem was the --drb switch - once I removed it, all was well:

    guard 'rspec', :version => 2, :cli => "" do
        ....
    end
    

    Now Growl notifies me immediately when tests pass/fail. Hurrah!