2010-10-03 21:00:33 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Guard::Notifier do
|
|
|
|
subject { Guard::Notifier }
|
2011-04-10 20:32:29 +00:00
|
|
|
|
2011-04-16 21:13:29 +00:00
|
|
|
describe ".notify" do
|
2011-05-06 21:19:31 +00:00
|
|
|
before(:each) { subject.turn_on }
|
|
|
|
|
|
|
|
if mac?
|
|
|
|
if growl_installed?
|
|
|
|
it "uses Growl on Mac OS X" do
|
|
|
|
Growl.should_receive(:notify).with("great",
|
|
|
|
:title => "Guard",
|
|
|
|
:icon => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s,
|
|
|
|
:name => "Guard"
|
|
|
|
)
|
|
|
|
subject.notify 'great', :title => 'Guard'
|
|
|
|
end
|
|
|
|
else
|
|
|
|
it { should be_disabled }
|
|
|
|
end
|
2011-04-16 21:13:29 +00:00
|
|
|
end
|
2011-04-10 20:32:29 +00:00
|
|
|
|
2011-05-06 21:19:31 +00:00
|
|
|
if linux?
|
|
|
|
if libnotify_installed?
|
|
|
|
it "uses Libnotify on Linux" do
|
|
|
|
Libnotify.should_receive(:show).with(
|
|
|
|
:body => "great",
|
|
|
|
:summary => 'Guard',
|
|
|
|
:icon_path => Pathname.new(File.dirname(__FILE__)).join('../../images/success.png').to_s
|
|
|
|
)
|
|
|
|
subject.notify 'great', :title => 'Guard'
|
|
|
|
end
|
|
|
|
else
|
|
|
|
it { should be_disabled }
|
2010-10-17 19:42:40 +00:00
|
|
|
end
|
2010-10-03 21:00:33 +00:00
|
|
|
end
|
2011-05-06 21:19:31 +00:00
|
|
|
end
|
2011-04-10 20:32:29 +00:00
|
|
|
|
2011-05-06 21:19:31 +00:00
|
|
|
describe ".turn_off" do
|
2011-05-07 16:40:13 +00:00
|
|
|
before(:each) { subject.turn_off }
|
|
|
|
|
2011-05-06 21:19:31 +00:00
|
|
|
if mac? && growl_installed?
|
|
|
|
it "does nothing" do
|
|
|
|
Growl.should_not_receive(:notify)
|
2010-10-21 08:27:31 +00:00
|
|
|
subject.notify 'great', :title => 'Guard'
|
2010-10-17 19:42:40 +00:00
|
|
|
end
|
2011-05-07 16:40:13 +00:00
|
|
|
elsif linux? && libnotify_installed?
|
2011-05-06 21:19:31 +00:00
|
|
|
it "does nothing" do
|
|
|
|
Libnotify.should_not_receive(:show)
|
|
|
|
subject.notify 'great', :title => 'Guard'
|
2011-04-10 20:32:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-05-06 21:19:31 +00:00
|
|
|
it { should be_disabled }
|
2010-10-03 21:00:33 +00:00
|
|
|
end
|
2011-04-10 20:32:29 +00:00
|
|
|
|
2011-04-16 21:13:29 +00:00
|
|
|
end
|