Sha256: 80d11f97bb3ecd411629413ae183d546dcedede10665c322140fa204dc8f417c

Contents?: true

Size: 925 Bytes

Versions: 8

Compression:

Stored size: 925 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

8 entries across 8 versions & 1 rubygems

Version Path
beaker-4.42.0 spec/beaker/shared/error_handler_spec.rb
beaker-4.41.2 spec/beaker/shared/error_handler_spec.rb
beaker-4.41.1 spec/beaker/shared/error_handler_spec.rb
beaker-4.41.0 spec/beaker/shared/error_handler_spec.rb
beaker-4.40.2 spec/beaker/shared/error_handler_spec.rb
beaker-4.40.1 spec/beaker/shared/error_handler_spec.rb
beaker-4.40.0 spec/beaker/shared/error_handler_spec.rb
beaker-4.39.0 spec/beaker/shared/error_handler_spec.rb