spec/slogger/common_logger_spec.rb in slogger-0.0.8 vs spec/slogger/common_logger_spec.rb in slogger-0.0.9

- old
+ new

@@ -15,10 +15,27 @@ it "should have a facility attribute" do subject.facility.should == :local0 end end + describe "#level" do + mappings = { + :debug => Logger::DEBUG, + :info => Logger::INFO, + :warn => Logger::WARN, + :error => Logger::ERROR, + :fatal => Logger::FATAL + } + + mappings.each_pair do |key, value| + it "should map #{key.inspect} to #{value}" do + logger = Slogger::CommonLogger.new "test_app", key, :local0 + logger.level.should == value + end + end + end + describe "invalid state" do it "should raise ArgumentError if doesn't have app_name" do lambda { Slogger::CommonLogger.new nil, :debug, :local0 }.should raise_error end @@ -112,12 +129,12 @@ describe "when no message is passed to the log method" do it "should use the block to form the message" do subject.severity = :info messenger = mock('messenger') - messenger.should_receive(:message).and_return('this is a message %{name}') + messenger.should_receive(:message).and_return('this is a message %s') Syslog.should_receive(:info).with('%s','this is a message logger').and_return(Syslog) - subject.info { messenger.message % {:name => 'logger'} } + subject.info { messenger.message % ('logger') } end end describe "when a block is passed to log method" do it "should add spent time to the message" do