Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mock growl test

  • Loading branch information...
commit 126e0d56210a7ac4e9a8ae70ff17f882873272ca 1 parent e55161c
@flyerhzm authored
Showing with 19 additions and 3 deletions.
  1. +19 −3 spec/uniform_notifier/growl_spec.rb
View
22 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
Please sign in to comment.
Something went wrong with that request. Please try again.