spec/rollbar_spec.rb in rollbar-2.7.0 vs spec/rollbar_spec.rb in rollbar-2.7.1

- old
+ new

@@ -1,10 +1,9 @@ # encoding: utf-8 require 'logger' require 'socket' -require 'spec_helper' require 'girl_friday' require 'redis' require 'active_support/core_ext/object' require 'active_support/json/encoding' @@ -12,10 +11,12 @@ require 'sucker_punch' require 'sucker_punch/testing/inline' rescue LoadError end +require 'spec_helper' + describe Rollbar do let(:notifier) { Rollbar.notifier } before do Rollbar.unconfigure configure @@ -642,9 +643,16 @@ chain[0][:exception][:class].should match(/StandardError/) chain[0][:exception][:message].should match(/the error/) chain[1][:exception][:class].should match(/CauseException/) chain[1][:exception][:message].should match(/the cause/) + end + + it 'ignores the cause when it is not an Exception' do + exception_with_custom_cause = Exception.new('custom cause') + allow(exception_with_custom_cause).to receive(:cause) { "Foo" } + body = notifier.send(:build_payload_body_exception, message, exception_with_custom_cause, extra) + body[:trace].should_not be_nil end context 'with cyclic nested exceptions' do let(:exception1) { Exception.new('exception1') } let(:exception2) { Exception.new('exception2') }