Sha256: 0378a49f89c5022084e48a1d8d70e6548722120f924f74e108da4782ec1e5ec4
Contents?: true
Size: 1.97 KB
Versions: 24
Compression:
Stored size: 1.97 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'lib', 'flapjack', 'notifier_engine') require File.join(File.dirname(__FILE__), '..', 'lib', 'flapjack', 'transports', 'result') require File.join(File.dirname(__FILE__), 'helpers') describe "running the notifier" do before(:each) do end it "should complain if no logger has been specified" do lambda { n = Flapjack::NotifierEngine.new }.should raise_error(RuntimeError) end it "should warn if no notifiers have been specified" do n = Flapjack::NotifierEngine.new(:log => MockLogger.new) n.log.messages.last.should =~ /no notifiers/ end it "should log when adding a new notifier" do mock_notifier = mock("MockFlapjack::NotifierEngine") n = Flapjack::NotifierEngine.new(:log => MockLogger.new, :notifiers => [mock_notifier]) n.log.messages.last.should =~ /using the (.+) notifier/ end it "should call notify on each notifier when notifying" do mock_notifier = mock("MockFlapjack::NotifierEngine") mock_notifier.should_receive(:notify) result = Flapjack::Transport::Result.new(:result => {:check_id => 12345}) n = Flapjack::NotifierEngine.new(:log => MockLogger.new, :notifiers => [mock_notifier]) n.notify!(:result => result, :event => true, :recipients => [OpenStruct.new({:name => "John Doe"})]) end it "should log notification on each notifier" do mock_notifier = mock("MockFlapjack::NotifierEngine") mock_notifier.stub!(:notify) result = Flapjack::Transport::Result.new(:result => {:check_id => 12345}) n = Flapjack::NotifierEngine.new(:log => MockLogger.new, :notifiers => [mock_notifier]) n.notify!(:result => result, :event => true, :recipients => [OpenStruct.new({:name => "John Doe"})]) n.log.messages.last.should =~ /12345/ n.log.messages.last.should =~ /John Doe/ end end
Version data entries
24 entries across 24 versions & 1 rubygems