test/test_logging.rb in logging-0.5.3 vs test/test_logging.rb in logging-0.6.0

- old
+ new

@@ -1,34 +1,24 @@ -# $Id: test_logging.rb 38 2007-10-26 20:05:51Z tim_pease $ +# $Id: test_logging.rb 72 2007-12-26 21:59:58Z tim_pease $ require 'test/setup.rb' require 'fileutils' module TestLogging class TestLogging < Test::Unit::TestCase include LoggingTestCase - TMP = 'tmp' - def setup super @levels = ::Logging::LEVELS @lnames = ::Logging::LNAMES - FileUtils.rm_rf TMP - FileUtils.mkdir(TMP) @fn = File.join(TMP, 'test.log') @glob = File.join(TMP, '*.log') end - def teardown - h = ::Logging::Repository.instance.instance_variable_get :@h - h.values.each {|l| l.close if l.respond_to? :close} - FileUtils.rm_rf TMP - end - def test_configure assert_raise(ArgumentError) {::Logging.configure 'blah.txt'} ::Logging.configure 'data/logging.yaml' @@ -46,11 +36,11 @@ # start with the File appender logfile = ::Logging::Appender['logfile'] assert_instance_of ::Logging::Appenders::File, logfile assert_equal 0, logfile.level - assert_equal 'temp.log', logfile.instance_variable_get(:@fn) + assert_equal 'tmp/temp.log', logfile.instance_variable_get(:@fn) layout = logfile.layout assert_instance_of ::Logging::Layouts::Pattern, layout assert_equal '[%d] %l %c : %m\\n', layout.pattern assert_equal 'to_s', layout.date_method @@ -85,12 +75,9 @@ assert_equal false, yourlogger.trace appenders = yourlogger.instance_variable_get :@appenders assert_equal 2, appenders.length assert_equal ['logfile', 'stderr'], appenders.map {|a| a.name}.sort - - # cleanup - File.delete('temp.log') if File.exist?('temp.log') end def test_logger assert_raise(TypeError) {::Logging.logger []}