From 6bca96093126714d52b771c67d780c2f30827354 Mon Sep 17 00:00:00 2001 From: Nate Berkopec Date: Tue, 22 Nov 2016 08:42:15 -0700 Subject: [PATCH] Add aliases for capture_message/exception on Instance --- lib/raven/instance.rb | 3 +++ spec/raven/instance_spec.rb | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/raven/instance.rb b/lib/raven/instance.rb index 434a78e3b..2f43e1ee7 100644 --- a/lib/raven/instance.rb +++ b/lib/raven/instance.rb @@ -135,6 +135,9 @@ def capture_type(obj, options = {}) end end + alias capture_message capture_type + alias capture_exception capture_type + def last_event_id Thread.current["sentry_#{object_id}_last_event_id".to_sym] end diff --git a/spec/raven/instance_spec.rb b/spec/raven/instance_spec.rb index db64d64d7..b3eecedd0 100644 --- a/spec/raven/instance_spec.rb +++ b/spec/raven/instance_spec.rb @@ -41,6 +41,13 @@ subject.capture_type(message, options) end + it 'has an alias' do + expect(Raven::Event).to receive(:from_message).with(message, options) + expect(subject).to receive(:send_event).with(event) + + subject.capture_message(message, options) + end + it 'yields the event to a passed block' do expect { |b| subject.capture_type(message, options, &b) }.to yield_with_args(event) end @@ -80,6 +87,13 @@ subject.capture_type(exception, options) end + it 'has an alias' do + expect(Raven::Event).to receive(:from_exception).with(exception, options) + expect(subject).to receive(:send_event).with(event) + + subject.capture_exception(exception, options) + end + it 'yields the event to a passed block' do expect { |b| subject.capture_type(exception, options, &b) }.to yield_with_args(event) end