updated the growl notify code to gracefuly fail if growl is not installed - this is new in growl_notify-0.0.3

This commit is contained in:
Scott Davis 2011-10-05 01:10:48 -04:00
parent 8b6a035dfe
commit 1181b8b234
2 changed files with 14 additions and 1 deletions

View File

@ -181,6 +181,9 @@ module Guard
end
rescue LoadError
require 'growl'
rescue ::GrowlNotify::GrowlNotFound
turn_off
UI.info "Please install Growl from http://growl.info"
end
rescue LoadError
turn_off

View File

@ -21,11 +21,21 @@ describe Guard::Notifier do
context "with the GrowlNotify library available" do
before do
module ::GrowlNotify
class ::GrowlNotify
class GrowlNotFound < Exception; end
def self.config ; end
end
end
it "should respond properly to a GrowlNotify exception" do
::GrowlNotify.should_receive(:config).and_raise ::GrowlNotify::GrowlNotFound
::GrowlNotify.should_receive(:application_name).and_return ''
::Guard::UI.should_receive(:info)
described_class.should_receive(:require).with('growl_notify').and_return true
described_class.turn_on
described_class.should_not be_enabled
end
it "loads the library and enables the notifications" do
described_class.should_receive(:require).with('growl_notify').and_return true
GrowlNotify.should_receive(:application_name).and_return ''