Sha256: c4dc17dc2bdacf81c4755743a6f63da0592eea30d2c9ed26a3540dd7eeb814a3

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require "spec_helper"

require "pry"
describe Alephant::Logger::Base do
  context "no Alephant::Logger::JSON driver given" do
    it "defaults to include Alephant::Logger::JSON" do
      allow(Alephant::Logger::JSON).to receive(:new) { @called = true }

      described_class.new []
      expect(@called).to be_truthy
    end
  end

  describe "#info" do
    context "no logger drivers given" do
      subject { Alephant::Logger::Base.new [] }

      specify do
        expect_any_instance_of(Alephant::Logger::JSON).to receive(:info).with("event" => "Evented")

        subject.info("event" => "Evented")
      end
    end

    context "logger drivers given" do
      subject { Alephant::Logger::Base.new [driver] }

      let(:driver) { double }

      it "responding drivers receive method calls" do
        expect(driver).to receive(:metric).with("foo")

        subject.metric("foo")
      end

      it "Alephant::Logger::JSON is always used" do
        expect_any_instance_of(Alephant::Logger::JSON).to receive(:info).with("event" => "Evented")

        subject.info("event" => "Evented")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alephant-logger-3.1.4 spec/logger_base_spec.rb
alephant-logger-3.1.2 spec/logger_base_spec.rb
alephant-logger-3.1.1 spec/logger_base_spec.rb
alephant-logger-3.1.0 spec/logger_base_spec.rb
alephant-logger-3.0.2 spec/logger_base_spec.rb
alephant-logger-3.0.1 spec/logger_base_spec.rb
alephant-logger-3.0.0 spec/logger_base_spec.rb
alephant-logger-2.0.0 spec/logger_base_spec.rb