Sha256: 3ff6cd770d3a03976ed023bb510d0bc755b8559f5b970692a9d1d3e831bb49d6
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require "spec_helper" require "logger" describe "logger" do before(:each) do Mblox.reset_configuration end after(:all) do set_configuration end it "should allow log level info" do Mblox.config.log_at :info Mblox.config.logger = ::Logger.new('/dev/null') expect { Mblox.log "Some info" }.to_not raise_error end it "should default to log level debug" do expect(Mblox.config.log_level).to eq(:debug) expect { Mblox.log "Some debug info" }.to_not raise_error end it "should not allow log level news when the logger is created after log level is set" do Mblox.config.log_at :news expect { Mblox.config.logger = ::Logger.new(STDOUT)}.to raise_error(ArgumentError, "Mblox log level must be set to :fatal, :error, :warn, :info or :debug") expect { Mblox.log "Some news" }.to_not raise_error end it "should not allow log level news when the logger is created before log level is set and should remain in a valid state" do Mblox.config.logger = ::Logger.new("/dev/null") expect { Mblox.config.log_at :news }.to raise_error(ArgumentError, "Mblox log level must be set to :fatal, :error, :warn, :info or :debug") expect { Mblox.log "Some news" }.to_not raise_error end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mblox-0.0.3 | spec/log_spec.rb |
mblox-0.0.2 | spec/log_spec.rb |