test/better_test.rb in logger-better-0.1.3 vs test/better_test.rb in logger-better-0.2.0

- old
+ new

@@ -1,16 +1,19 @@ require_relative 'test_helper' -require 'logger/better' -require 'stringio' class BetterTest < MiniTest::Unit::TestCase attr_reader :formatter def setup - @formatter = Logger::Formatter.new + @formatter = Logger::Better::TimestampFormatter.new end + def test_uses_the_correct_formatter + logger = Logger::Better.new $stdout + assert_instance_of Logger::Better::TimestampFormatter, logger.formatter + end + def test_uses_utc_iso_8601_times time = Time.now log = formatter.call 'info', time, 'app', 'hi' assert_includes log, time.utc.iso8601 end @@ -49,11 +52,11 @@ # strip here because all lines will have a new line. assert_equal '!', log.strip[-1] end def test_can_set_level_with_symbol - logger = Logger.new StringIO.new + logger = Logger::Better.new StringIO.new logger.level = :debug assert_equal Logger::DEBUG, logger.level logger.level = :info assert_equal Logger::INFO, logger.level @@ -66,10 +69,10 @@ logger.level = :unknown assert_equal Logger::UNKNOWN, logger.level end def tests_sets_level_unkown_when_passing_an_unkown_symol - logger = Logger.new StringIO.new + logger = Logger::Better.new StringIO.new logger.level = :foo assert_equal Logger::UNKNOWN, logger.level end