Skip to content

Commit

Permalink
changed reference of :logger to :log to be internally consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
auxesis committed Nov 23, 2009
1 parent 704d6de commit 40d36e4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion spec/mock-notifiers/mock/mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions spec/notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
24 changes: 12 additions & 12 deletions spec/pluggable_notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')} }
Expand All @@ -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)
Expand All @@ -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')} }
Expand All @@ -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,
Expand All @@ -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)
Expand All @@ -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')} }
Expand All @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/queue_backends/beanstalkd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')}}
Expand Down
12 changes: 6 additions & 6 deletions spec/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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')
Expand Down

0 comments on commit 40d36e4

Please sign in to comment.