spec/logger_base_spec.rb in alephant-logger-1.2.1 vs spec/logger_base_spec.rb in alephant-logger-2.0.0

- old
+ new

@@ -1,16 +1,26 @@ 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(::Logger).to receive(:info).with "msg" + expect_any_instance_of(Alephant::Logger::JSON).to receive(:info).with("event" => "Evented") - subject.info "msg" + subject.info("event" => "Evented") end end context "logger drivers given" do subject { Alephant::Logger::Base.new [driver] } @@ -21,13 +31,13 @@ expect(driver).to receive(:metric).with("foo") subject.metric("foo") end - it "::Logger is always used" do - expect_any_instance_of(::Logger).to receive(:info).with "foo" + it "Alephant::Logger::JSON is always used" do + expect_any_instance_of(Alephant::Logger::JSON).to receive(:info).with("event" => "Evented") - subject.info "foo" + subject.info("event" => "Evented") end end end end