spec/boty/logger_spec.rb in boty-0.0.17.1 vs spec/boty/logger_spec.rb in boty-0.1.0

- old
+ new

@@ -13,9 +13,42 @@ client.logger.info "hello" end end + describe "#logger" do + it "returns the current adapter" do + memory_logger = Boty::Logger::Memory.new + logger.adapter = memory_logger + expect(client.logger).to eq memory_logger + end + end + + describe Logger::Multi do + let(:adapter1) { double } + let(:adapter2) { double } + + subject(:multi) { described_class.new [adapter1, adapter2] } + + describe "#add" do + it "delegates the #add invocation to the underlying adapters" do + expect(adapter1).to receive(:add).with("omg", "lol") + expect(adapter2).to receive(:add).with("omg", "lol") + + multi.add("omg", "lol") + end + end + + describe "#level=" do + it "delegates the #level= invocation to the underlying adapters" do + expect(adapter1).to receive(:level=).with(::Logger::INFO) + expect(adapter2).to receive(:level=).with(::Logger::INFO) + + multi.level = ::Logger::INFO + end + end + end + describe Logger::Memory do subject(:adapter) { described_class.new } before do logger.adapter = adapter