Sha256: 3e870e7e317ec9e08bf23414353a405497c2ebc708c66e3d75c6e38fc193643b

Contents?: true

Size: 1022 Bytes

Versions: 2

Compression:

Stored size: 1022 Bytes

Contents

require 'spec_helper'

describe Alephant::LogSystem do
  before(:each) do
    sequencer = double()
    queue     = double()
    cache     = double()
    renderer  = double()

    Alephant::Sequencer.stub(:create).and_return(sequencer)
    Alephant::Queue.any_instance.stub(:initialize).and_return(queue)
    Alephant::Cache.any_instance.stub(:initialize).and_return(cache)
    Alephant::Renderer.any_instance.stub(:initialize).and_return(renderer)
  end

  after(:each) do
    Alephant.logger = nil
  end

  let (:instance) { Alephant::Alephant }
  subject { Alephant::LogSystem }

  describe "::Alephant::LogSystem.logger" do
    context "Logger not provided" do
      it "return Ruby built-in Logger" do
        instance.new
        expect(Alephant.logger.class).to be(Logger)
      end
    end

    context "Logger provided" do
      it "return custom Logger" do
        class FakeLogger; end
        instance.new({}, FakeLogger.new)
        expect(Alephant.logger.class).to be(FakeLogger)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alephant-0.0.9.9.1-java spec/logger_spec.rb
alephant-0.0.9.9-java spec/logger_spec.rb