From fc3a4c5d22209f13e27d201e1edba9118d2e0ed7 Mon Sep 17 00:00:00 2001 From: Ripta Pasay Date: Tue, 12 May 2015 12:34:00 -0700 Subject: [PATCH] Use #send_event when capturing an exception The #send method is deprecated, and causes noisy warnings. --- lib/raven/base.rb | 4 ++-- spec/raven/integration_spec.rb | 2 +- spec/raven/raven_spec.rb | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/raven/base.rb b/lib/raven/base.rb index 2590f79db..270412763 100644 --- a/lib/raven/base.rb +++ b/lib/raven/base.rb @@ -78,7 +78,7 @@ def configure # # @example # evt = Raven::Event.new(:message => "An error") - # Raven.send(evt) + # Raven.send_event(evt) def send_event(event) client.send_event(event) end @@ -119,7 +119,7 @@ def capture_type(obj, options = {}) if configuration.async? configuration.async.call(evt) else - send(evt) + send_event(evt) end end end diff --git a/spec/raven/integration_spec.rb b/spec/raven/integration_spec.rb index 8b7fb8bb4..ca583379f 100644 --- a/spec/raven/integration_spec.rb +++ b/spec/raven/integration_spec.rb @@ -55,7 +55,7 @@ config.http_adapter = [:test, stubs] end - expect(Raven.logger).to receive(:warn).exactly(2).times + expect(Raven.logger).to receive(:warn).once expect { Raven.capture_exception(build_exception) }.not_to raise_error stubs.verify_stubbed_calls diff --git a/spec/raven/raven_spec.rb b/spec/raven/raven_spec.rb index 98b1b31e7..d7707afa3 100644 --- a/spec/raven/raven_spec.rb +++ b/spec/raven/raven_spec.rb @@ -5,7 +5,7 @@ let(:options) { double("options") } before do - allow(Raven).to receive(:send) + allow(Raven).to receive(:send_event) allow(Raven::Event).to receive(:from_message) { event } allow(Raven::Event).to receive(:from_exception) { event } end @@ -15,7 +15,7 @@ it 'sends the result of Event.capture_message' do expect(Raven::Event).to receive(:from_message).with(message, options) - expect(Raven).to receive(:send).with(event) + expect(Raven).to receive(:send_event).with(event) Raven.capture_message(message, options) end @@ -30,7 +30,7 @@ it 'sends the result of Event.capture_message' do expect(Raven::Event).to receive(:from_message).with(message, options) - expect(Raven).not_to receive(:send).with(event) + expect(Raven).not_to receive(:send_event).with(event) prior_async = Raven.configuration.async Raven.configuration.async = lambda { :ok } @@ -45,7 +45,7 @@ it 'sends the result of Event.capture_exception' do expect(Raven::Event).to receive(:from_exception).with(exception, options) - expect(Raven).to receive(:send).with(event) + expect(Raven).to receive(:send_event).with(event) Raven.capture_exception(exception, options) end @@ -60,7 +60,7 @@ it 'sends the result of Event.capture_exception' do expect(Raven::Event).to receive(:from_exception).with(exception, options) - expect(Raven).not_to receive(:send).with(event) + expect(Raven).not_to receive(:send_event).with(event) prior_async = Raven.configuration.async Raven.configuration.async = lambda { :ok } @@ -74,7 +74,7 @@ let(:exception) { build_exception } it 'sends the result of Event.capture_exception according to the result of should_capture' do - expect(Raven).not_to receive(:send).with(event) + expect(Raven).not_to receive(:send_event).with(event) prior_should_capture = Raven.configuration.should_capture Raven.configuration.should_capture = Proc.new { false }