Sha256: 6f65c8682671cf0cdd68f5c8a5b10dee34fff3ba120660cf90e6d2d4c37bf462

Contents?: true

Size: 1016 Bytes

Versions: 35

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

describe Mongo::Logger do

  let(:logger) do
    described_class.logger
  end

  describe '.logger' do

    context 'when no logger has been set' do

      let(:test_logger) do
        Mongo::Logger.logger
      end

      before do
        Mongo::Logger.logger = nil
      end

      after do
        Mongo::Logger.logger = test_logger
      end

      it 'returns the default logger' do
        expect(logger.level).to eq(Logger::DEBUG)
      end
    end

    context 'when a logger has been set' do

      let(:info) do
        Logger.new($stdout).tap do |log|
          log.level = Logger::INFO
        end
      end

      let(:debug) do
        Logger.new($stdout).tap do |log|
          log.level = Logger::DEBUG
        end
      end

      before do
        described_class.logger = debug
      end

      after do
        described_class.logger = info
      end

      it 'returns the provided logger' do
        expect(logger.level).to eq(Logger::DEBUG)
      end
    end
  end
end

Version data entries

35 entries across 32 versions & 3 rubygems

Version Path
mongo-2.6.0 spec/mongo/logger_spec.rb
mongo-2.5.3 spec/mongo/logger_spec.rb
mongo-2.5.2 spec/mongo/logger_spec.rb
tdiary-5.0.8 vendor/bundle/gems/mongo-2.5.1/spec/mongo/logger_spec.rb
mongo-2.5.1 spec/mongo/logger_spec.rb
mongo-2.5.0 spec/mongo/logger_spec.rb
mongo-2.5.0.beta spec/mongo/logger_spec.rb
mongo-2.4.3 spec/mongo/logger_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongo-2.4.1/spec/mongo/logger_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.2/spec/mongo/logger_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.1/spec/mongo/logger_spec.rb
mongo-2.4.2 spec/mongo/logger_spec.rb
tdiary-5.0.4 vendor/bundle/gems/mongo-2.4.1/spec/mongo/logger_spec.rb
mongo-2.4.1 spec/mongo/logger_spec.rb
mongo-2.4.0 spec/mongo/logger_spec.rb
mongo-2.3.1 spec/mongo/logger_spec.rb
mongo-2.4.0.rc1 spec/mongo/logger_spec.rb
mongo-2.4.0.rc0 spec/mongo/logger_spec.rb
mongo-2.3.0 spec/mongo/logger_spec.rb
mongo-2.2.7 spec/mongo/logger_spec.rb