Skip to content

Commit

Permalink
mock growl test
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Nov 19, 2010
1 parent e55161c commit 126e0d5
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions spec/uniform_notifier/growl_spec.rb
@@ -1,9 +1,25 @@
require 'spec_helper'
require 'ruby-growl'

describe UniformNotifier::Growl do

it "should notify growl without password" do
growl = double('growl')
Growl.should_receive(:new).with('localhost', 'uniform_notifier', ['uniform_notifier'], nil, nil).and_return(growl)
growl.should_receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'Uniform Notifier Growl has been turned on').ordered
growl.should_receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'notify growl without password').ordered

UniformNotifier.growl = true
p UniformNotifier::Growl.out_of_channel_notify('notify growl without password').methods.sort
UniformNotifier::Growl.out_of_channel_notify('notify growl without password')
end

it "should notify growl with password" do
growl = double('growl')
Growl.should_receive(:new).with('localhost', 'uniform_notifier', ['uniform_notifier'], nil, '123456').and_return(growl)
growl.should_receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'Uniform Notifier Growl has been turned on').ordered
growl.should_receive(:notify).with('uniform_notifier', 'Uniform Notifier', 'notify growl with password').ordered

UniformNotifier.growl = { :password => '123456' }
UniformNotifier::Growl.out_of_channel_notify('notify growl with password')
end
end
end

0 comments on commit 126e0d5

Please sign in to comment.