Sha256: c50cdd2dd48e65aec5a0aa03ef1c03b23e468e7727bb7618917d3982f26c88fe

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

require 'spec_helper'

describe Logput::Adapters::Logger do
  describe '.handles?' do
    it 'returns true when passed a Logger instance' do
      expect(described_class.handles?(::Logger.new)).to eq(true)
    end

    it 'returns false when passed anything else' do
      expect(described_class.handles?(::ActiveSupport::TaggedLogging.new)).to eq(false)
      expect(described_class.handles?(:foo)).to eq(false)
    end
  end

  describe '#path' do
    let(:path) { './spec/support/test.log' }
    let(:logger) { ::Logger.new }
    let(:logdev) { double(:filename => path) }

    before :each do
      allow(logger).to receive(:instance_variable_get).with(:@logdev).and_return(logdev)
    end

    subject { described_class.new(logger) }

    it 'returns the correct path' do
      expect(subject.path).to eq(path)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logput-0.0.4 spec/adapters/logger_spec.rb