hook into Airbreak#notify_or_ignore

This commit is contained in:
2012-02-03 14:26:34 +00:00
parent 992fda152d
commit aabcf073e8
2 changed files with 37 additions and 1 deletions

View File

@@ -9,5 +9,13 @@ module Airbrake
alias :notify_without_statsd :notify
alias :notify :notify_with_statds
def notify_or_ignore_with_statsd(*args)
Airbrake::Statsd.increment
notify_or_ignore_without_statsd(*args)
end
alias :notify_or_ignore_without_statsd :notify_or_ignore
alias :notify_or_ignore :notify_or_ignore_with_statsd
end
end

View File

@@ -8,8 +8,12 @@ describe Airbrake do
subject.method(:notify).should == subject.method(:notify_with_statds)
end
describe '#notify_without_statsd' do
it '#notify_or_ignore is an alias to #notify_or_ignore_with_statsd' do
subject.method(:notify_or_ignore).
should == subject.method(:notify_or_ignore_with_statsd)
end
describe '#notify_without_statsd' do
it 'does not call Airbrake::Statsd.increment' do
Airbrake.stub(:send_notice).and_return(nil)
@@ -31,4 +35,28 @@ describe Airbrake do
end
end
describe '#notify_or_ignore_without_statsd' do
it 'does not call Airbrake::Statsd.increment' do
Airbrake.stub(:send_notice).and_return(nil)
Airbrake.should_receive(:build_notice_for).with('oops', {}).
and_return(mock('Notice', :ignore? => false))
Airbrake::Statsd.should_not_receive(:increment)
Airbrake.notify_or_ignore_without_statsd('oops', {})
end
end
describe '#notify_or_ignore' do
it 'calls Airbrake::Statsd.increment' do
Airbrake.stub(:send_notice).and_return(nil)
Airbrake.should_receive(:build_notice_for).with('oops', {}).
and_return(mock('Notice', :ignore? => false))
Airbrake::Statsd.should_receive(:increment)
Airbrake.notify_or_ignore('oops', {})
end
end
end