Sha256: 6e55bea23ccb20bb1429089f08ca711d914a3bcbc4617eb8d51273964587c4a5
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 KB
Contents
require File.join(File.dirname(__FILE__), "..", "/spec_helper") describe Slogger::Logger do describe "valid state" do subject { Slogger::Logger.new "test_app", :debug, :local0 } its(:app_name) { should == "test_app" } its(:level) { should == :debug } its(:facility) { should == :local0 } end describe "invalid state" do it "should raise ArgumentError if doen't have app_name" do lambda { Slogger::Logger.new nil, :debug, :local0 }.should raise_error end it "should raise ArgumentError if doen't have level" do lambda { Slogger::Logger.new "test_app", nil, :local0 }.should raise_error end it "should raise ArgumentError if doen't have facility" do lambda { Slogger::Logger.new "test_app", :debug, nil }.should raise_error end end describe "when in warning level" do subject { Slogger::Logger.new "test_app", :warning, :local0 } it "should log WARNING messages" do Syslog.stub!(:warning).with(anything).and_return(Syslog) Syslog.should_receive(:warning).and_return(Syslog) subject.warning "WARNING message" end it "shouldn't log INFO messages" do Syslog.stub!(:info).with(anything).and_return(Syslog) Syslog.should_not_receive(:info).and_return(Syslog) subject.info "INFO message" end end describe "when a block is passed to log method" do subject { Slogger::Logger.new "test_app", :debug, :local0 } it "it should add spent time to the message" do subject.info "a block wrapped by log" do sleep(10) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slogger-0.0.2 | spec/slogger/logger_spec.rb |