Sha256: 809cdd250abeb122c2d73b0c0e67a385fcc3dad45cdf9cb2dfd4a9df18f2bd65

Contents?: true

Size: 780 Bytes

Versions: 22

Compression:

Stored size: 780 Bytes

Contents

require 'spec_helper'

describe Rollbar::LoggerProxy do
  let(:logger) { double(:logger) }
  let(:message) { 'the-message' }

  subject { described_class.new(logger) }

  shared_examples 'delegate to logger' do
    it 'logs with correct level' do
      expect(logger).to receive(level).with(message)

      subject.send(level, message)
    end
  end

  %w(info error warn debug).each do |level|
    describe "#{level}" do
      it_should_behave_like 'delegate to logger' do
        let(:level) { level }
      end
    end
  end

  describe '#call' do
    context 'if the logger fails' do
      it 'doesnt raise' do
        allow(logger).to receive(:info).and_raise(StandardError.new)

        expect { subject.log('info', message) }.not_to raise_error
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rollbar-2.1.1 spec/rollbar/logger_proxy_spec.rb
rollbar-2.1.0 spec/rollbar/logger_proxy_spec.rb