spec/timber/logger_spec.rb in timber-2.2.3 vs spec/timber/logger_spec.rb in timber-2.3.0

- old
+ new

@@ -19,16 +19,28 @@ logger = described_class.new(nil) expect(logger.formatter).to be_kind_of(Timber::Logger::MessageOnlyFormatter) end end - it "should allow multiple loggers" do + it "should allow multiple io devices" do io1 = StringIO.new io2 = StringIO.new logger = Timber::Logger.new(STDOUT, io1, io2) logger.info("hello world") expect(io1.string).to start_with("hello world @metadata {") expect(io2.string).to start_with("hello world @metadata {") + end + + it "should allow multiple io devices and loggers" do + io1 = StringIO.new + io2 = StringIO.new + io3 = StringIO.new + extra_logger = ::Logger.new(io3) + logger = Timber::Logger.new(STDOUT, io1, io2, extra_logger) + logger.info("hello world") + expect(io1.string).to start_with("hello world @metadata {") + expect(io2.string).to start_with("hello world @metadata {") + expect(io3.string).to end_with("hello world\n") end end describe "#add" do let(:time) { Time.utc(2016, 9, 1, 12, 0, 0) } \ No newline at end of file