Achievement Unlocked: true 100% coverage.
parent
b0d4ce8018
commit
c0556153b7
|
|
@ -19,7 +19,7 @@ module Squib
|
|||
# @api public
|
||||
def logger
|
||||
if @logger.nil?
|
||||
@logger = Logger.new(STDOUT);
|
||||
@logger = Logger.new($stdout);
|
||||
@logger.level = Logger::WARN;
|
||||
@logger.formatter = proc do |severity, datetime, m_progname, msg|
|
||||
"#{datetime} #{severity}: #{msg}\n"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Squib.logger do
|
||||
it 'uses the custom format' do
|
||||
Squib.logger = nil
|
||||
oldstdout = $stdout
|
||||
$stdout = StringIO.new
|
||||
Squib::logger.warn "Test warn"
|
||||
expect($stdout.string).to match /WARN: Test warn/
|
||||
$stdout = oldstdout
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue