spec/notifiers_spec.rb in notifiers-1.2.0 vs spec/notifiers_spec.rb in notifiers-1.2.1
- old
+ new
@@ -1,13 +1,29 @@
require 'spec_helper'
-describe 'notifiers' do
+describe Notifiers do
+ it { expect(growl).to be_instance_of(Notifiers::Growl) }
- it { growl.should be_instance_of(Growl) }
+ it { expect(knotify).to be_instance_of(Notifiers::Knotify) }
- it { knotify.should be_instance_of(Knotify) }
+ it { expect(notify_send).to be_instance_of(Notifiers::NotifySend) }
- it { notify_send.should be_instance_of(NotifySend)}
+ it { expect(lib_notify).to be_instance_of(Notifiers::NotifySend) }
- it { lib_notify.should be_instance_of(NotifySend)}
+ describe '#auto_discover' do
+ context 'when have a notifier library installed' do
+ it 'returns the notifier' do
+ expect(Notifiers::Growl).to receive(:installed?).and_return(true)
+ expect(auto_discover).to be_instance_of(Notifiers::Growl)
+ end
+ end
+ context 'when do not have a notifier library installed' do
+ it 'raises Notifier not Found' do
+ expect(Notifiers::Base).to receive(:subclasses).and_return([])
+ expect {
+ auto_discover
+ }.to raise_error(Notifiers::NotifierNotFound)
+ end
+ end
+ end
end
\ No newline at end of file