From 40d36e449be5be5bf4ae550414c5ec2784efc69c Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Tue, 24 Nov 2009 00:43:03 +0100 Subject: [PATCH] changed reference of :logger to :log to be internally consistent --- spec/mock-notifiers/mock/mock.rb | 2 +- spec/notifier_spec.rb | 10 +++++----- spec/pluggable_notifier_spec.rb | 24 ++++++++++++------------ spec/queue_backends/beanstalkd_spec.rb | 2 +- spec/worker_spec.rb | 12 ++++++------ 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spec/mock-notifiers/mock/mock.rb b/spec/mock-notifiers/mock/mock.rb index 8f04c5ec0..3496b57df 100644 --- a/spec/mock-notifiers/mock/mock.rb +++ b/spec/mock-notifiers/mock/mock.rb @@ -9,7 +9,7 @@ class Mock attr_accessor :log, :website_uri def initialize(opts={}) - @log = opts[:logger] + @log = opts[:log] @website_uri = opts[:website_uri] end diff --git a/spec/notifier_spec.rb b/spec/notifier_spec.rb index 53e53e5a5..1749bb308 100644 --- a/spec/notifier_spec.rb +++ b/spec/notifier_spec.rb @@ -14,19 +14,19 @@ end it "should have a blank recipients list if none specified" do - n = Flapjack::NotifierEngine.new(:logger => MockLogger.new) + n = Flapjack::NotifierEngine.new(:log => MockLogger.new) n.recipients.should_not be_nil n.recipients.size.should == 0 end it "should warn if no notifiers have been specified" do - n = Flapjack::NotifierEngine.new(:logger => MockLogger.new) + 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(:logger => MockLogger.new, + n = Flapjack::NotifierEngine.new(:log => MockLogger.new, :notifiers => [mock_notifier]) n.log.messages.last.should =~ /using the (.+) notifier/ end @@ -37,7 +37,7 @@ result = Flapjack::QueueBackends::Result.new(:result => {:check_id => 12345}) - n = Flapjack::NotifierEngine.new(:logger => MockLogger.new, + n = Flapjack::NotifierEngine.new(:log => MockLogger.new, :notifiers => [mock_notifier], :recipients => [OpenStruct.new({:name => "John Doe"})]) n.notify!(:result => result, :event => true) @@ -49,7 +49,7 @@ result = Flapjack::QueueBackends::Result.new(:result => {:check_id => 12345}) - n = Flapjack::NotifierEngine.new(:logger => MockLogger.new, + n = Flapjack::NotifierEngine.new(:log => MockLogger.new, :notifiers => [mock_notifier], :recipients => [OpenStruct.new({:name => "John Doe"})]) n.notify!(:result => result, :event => true) diff --git a/spec/pluggable_notifier_spec.rb b/spec/pluggable_notifier_spec.rb index 318bd9c4e..0bc7133bf 100644 --- a/spec/pluggable_notifier_spec.rb +++ b/spec/pluggable_notifier_spec.rb @@ -16,7 +16,7 @@ it "should log when loading a notifier" do options = { :notifiers => {:mailer => {}}, - :logger => MockLogger.new, + :log => MockLogger.new, :notifier_directories => [File.join(File.dirname(__FILE__),'notifier-directories', 'spoons')], :check_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'check_backends')} } @@ -26,7 +26,7 @@ it "should warn if a specified notifier doesn't exist" do options = { :notifiers => {:nonexistant => {}}, - :logger => MockLogger.new, + :log => MockLogger.new, :check_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'check_backends')} } app = Flapjack::Notifier::Application.run(options) @@ -35,7 +35,7 @@ it "should give precedence to notifiers in user-specified notifier directories" do options = { :notifiers => {:mailer => {}}, - :logger => MockLogger.new, + :log => MockLogger.new, :notifier_directories => [File.join(File.dirname(__FILE__),'notifier-directories', 'spoons')], :check_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'check_backends')} } @@ -49,7 +49,7 @@ it "should merge recipients from a file and a specified list of recipients" do options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :recipients => {:filename => File.join(File.dirname(__FILE__), 'fixtures', 'recipients.yaml'), :list => [{:name => "Spoons McDoom"}]}, :check_backend => {:type => :mockbackend, @@ -66,7 +66,7 @@ it "should load a beanstalkd as the default queue backend" do options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :check_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'check_backends')} } app = Flapjack::Notifier::Application.run(options) @@ -75,7 +75,7 @@ it "should load a queue backend as specified in options" do options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :queue_backend => {:type => :beanstalkd}, :check_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'check_backends')} } @@ -85,7 +85,7 @@ it "should raise if the specified queue backend doesn't exist" do options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :queue_backend => {:type => :nonexistant} } lambda { app = Flapjack::Notifier::Application.run(options) @@ -101,7 +101,7 @@ # options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :queue_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'queue_backends')}, :check_backend => {:type => :mockbackend, @@ -130,7 +130,7 @@ # options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :queue_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'queue_backends')}, :check_backend => {:type => :mockbackend, @@ -159,7 +159,7 @@ # options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :queue_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'queue_backends')}, :check_backend => {:type => :mockbackend, @@ -189,7 +189,7 @@ it "should load a check backend as specified in options" do options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :check_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), 'check_backends')} } app = Flapjack::Notifier::Application.run(options) @@ -198,7 +198,7 @@ it "should raise if the specified check backend doesn't exist" do options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :check_backend => {:type => :nonexistant} } lambda { app = Flapjack::Notifier::Application.run(options) diff --git a/spec/queue_backends/beanstalkd_spec.rb b/spec/queue_backends/beanstalkd_spec.rb index e2ec60e93..12b584a22 100644 --- a/spec/queue_backends/beanstalkd_spec.rb +++ b/spec/queue_backends/beanstalkd_spec.rb @@ -24,7 +24,7 @@ end options = { :notifiers => {}, - :logger => MockLogger.new, + :log => MockLogger.new, :queue_backend => {:type => :beanstalkd}, :check_backend => {:type => :mockbackend, :basedir => File.join(File.dirname(__FILE__), '..', 'check_backends')}} diff --git a/spec/worker_spec.rb b/spec/worker_spec.rb index c684857de..4247a7c8e 100644 --- a/spec/worker_spec.rb +++ b/spec/worker_spec.rb @@ -10,7 +10,7 @@ it "should be able to specify and host and port to connect to" do w = Flapjack::Worker.new(:host => 'localhost', :port => 13401, - :logger => MockLogger.new) + :log => MockLogger.new) w.jobs.should_not be_nil w.results.should_not be_nil # FIXME: probably very brittle @@ -22,7 +22,7 @@ sandbox = File.expand_path(File.join(File.dirname(__FILE__), 'check_sandbox')) w = Flapjack::Worker.new(:host => 'localhost', :port => 11300, - :logger => MockLogger.new, + :log => MockLogger.new, :check_directory => sandbox) # calls check spec/check_sandbox/echo output, retval = w.perform_check('echo foo') @@ -34,7 +34,7 @@ w = Flapjack::Worker.new(:host => 'localhost', :port => 11300, - :logger => MockLogger.new) + :log => MockLogger.new) # the pool should be touched beanstalk = mock("Beanstalk::Pool") @@ -58,7 +58,7 @@ it "should clean up after itself" do w = Flapjack::Worker.new(:host => 'localhost', :port => 11300, - :logger => MockLogger.new) + :log => MockLogger.new) # a new job should be created for the check beanstalk = mock("Beanstalk::Pool") @@ -81,7 +81,7 @@ it "should report the results of the check" do w = Flapjack::Worker.new(:host => 'localhost', :port => 11300, - :logger => MockLogger.new) + :log => MockLogger.new) # we need to put the results on the results beanstalk beanstalk = mock("Beanstalk::Pool") @@ -104,7 +104,7 @@ sandbox = File.expand_path(File.join(File.dirname(__FILE__), 'check_sandbox')) w = Flapjack::Worker.new(:host => 'localhost', :port => 11300, - :logger => MockLogger.new, + :log => MockLogger.new, :check_directory => sandbox) output, retval = w.perform_check('sandboxed_check')