Sha256: 517468b1d700f708e44eb17e909933f6400640fd103645946e06c31f5c71c5bd

Contents?: true

Size: 886 Bytes

Versions: 16

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

module Beaker
  module Shared
    describe ErrorHandler do
      let(:backtrace) { "I'm the backtrace\nYes I am!\nI have important information" }
      let(:logger)    { double('logger') }

      before do
        allow(logger).to receive(:error).and_return(true)
        allow(logger).to receive(:pretty_backtrace).and_return(backtrace)
      end

      context 'report_and_raise' do
        it "records the backtrace of the exception to the logger" do
          ex = Exception.new("ArgumentError")
          allow(ex).to receive(:backtrace).and_return(backtrace)
          mesg = "I'm the extra message"

          backtrace.each_line do |line|
            expect(logger).to receive(:error).with(line)
          end

          expect(subject).to receive(:raise).once

          subject.report_and_raise(logger, ex, mesg)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
beaker-6.4.1 spec/beaker/shared/error_handler_spec.rb
beaker-6.4.0 spec/beaker/shared/error_handler_spec.rb
beaker-6.3.0 spec/beaker/shared/error_handler_spec.rb
beaker-6.2.0 spec/beaker/shared/error_handler_spec.rb
beaker-6.1.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.8.1 spec/beaker/shared/error_handler_spec.rb
beaker-5.8.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.7.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.6.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.5.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.4.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.3.1 spec/beaker/shared/error_handler_spec.rb
beaker-5.3.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.2.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.1.0 spec/beaker/shared/error_handler_spec.rb
beaker-5.0.0 spec/beaker/shared/error_handler_spec.rb