Sha256: 7b86f794c1b4cced1bcdf01ba9aae98048783a71680a48f3d0e22b304455a325
Contents?: true
Size: 1010 Bytes
Versions: 43
Compression:
Stored size: 1010 Bytes
Contents
require 'spec_helper' describe CopyTunerClient::PrefixedLogger do let(:output_logger) { FakeLogger.new } let(:prefix) { "** NOTICE:" } let(:thread_info) { "[P:#{Process.pid}] [T:#{Thread.current.object_id}]" } subject { CopyTunerClient::PrefixedLogger.new(prefix, output_logger) } it "provides the prefix" do subject.prefix.should == prefix end it "provides the logger" do subject.original_logger.should == output_logger end [:debug, :info, :warn, :error, :fatal].each do |level| it "prefixes #{level} log messages" do message = 'hello' subject.send(level, message) output_logger.should have_entry(level, "#{prefix} #{thread_info} #{message}") end end it "calls flush for a logger that responds to flush" do output_logger.stubs(:flush) subject.flush output_logger.should have_received(:flush) end it "doesn't call flush for a logger that doesn't respond to flush" do lambda { subject.flush }.should_not raise_error end end
Version data entries
43 entries across 43 versions & 1 rubygems