Sha256: c32694267f3dde53ea8ceb592919683fd9c4cff8633d2a0bb7e28f1e09e613a6

Contents?: true

Size: 1.57 KB

Versions: 43

Compression:

Stored size: 1.57 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. setup])

module TestLogging
module TestConfig

  class TestConfigurator < Test::Unit::TestCase
    include LoggingTestCase

    def test_configuration
      begin
        load Logging.path(%w[data logging.rb])
      rescue Exception => err
        flunk err.inspect
      end

      levels = {
        'deb' => 0,
        'inf' => 1,
        'prt' => 2,
        'wrn' => 3,
        'err' => 4,
        'fat' => 5
      }
      assert_equal levels, Logging::LEVELS
      assert_equal :inspect, Logging::OBJ_FORMAT

      hash = Logging::Repository.instance.instance_variable_get(:@h)
      assert hash.has_key?('A::B::C')
      assert hash.has_key?('yourlogger')
    end

    def test_simple_configuration
      begin
        load Logging.path(%w[data simple_logging.rb])
      rescue Exception => err
        flunk err.inspect
      end

      levels = {
        'debug' => 0,
        'info'  => 1,
        'warn'  => 2,
        'error' => 3,
        'fatal' => 4
      }
      assert_equal levels, Logging::LEVELS
      assert_equal false, Logging.const_defined?('OBJ_FORMAT')

      root = Logging::Logger.root
      assert_equal 1, root.level
    end

    def test_bad_appender_configuration
      assert_raise(Logging::Config::Configurator::Error) {
        load Logging.path(%w[data bad_logging_1.rb])
      }
    end

    def test_bad_layout_configuration
      assert_raise(Logging::Config::Configurator::Error) {
        load Logging.path(%w[data bad_logging_2.rb])
      }
    end
  end

end  # module TestConfig
end  # module TestLogging

# EOF

Version data entries

43 entries across 43 versions & 6 rubygems

Version Path
TwP-logging-0.9.7 test/config/test_configurator.rb
TwP-logging-0.9.8.1 test/config/test_configurator.rb
TwP-logging-0.9.8.2 test/config/test_configurator.rb
TwP-logging-0.9.8 test/config/test_configurator.rb
TwP-logging-1.0.0 test/config/test_configurator.rb
TwP-logging-1.1.0 test/config/test_configurator.rb
TwP-logging-1.1.1 test/config/test_configurator.rb
TwP-logging-1.1.2 test/config/test_configurator.rb
TwP-logging-1.1.3 test/config/test_configurator.rb
TwP-logging-1.1.4 test/config/test_configurator.rb
TwP-logging-1.2.0 test/config/test_configurator.rb
TwP-logging-1.2.2 test/config/test_configurator.rb
ottobar-logging-0.9.5.1 test/config/test_configurator.rb
pjstadig-logging-1.1.4.1 test/config/test_configurator.rb
logging-1.4.3 test/config/test_configurator.rb
sgeorgi-logging-1.4.2 test/config/test_configurator.rb
logging-1.4.2 test/config/test_configurator.rb
logging-1.4.1 test/config/test_configurator.rb
logging-1.4.0 test/config/test_configurator.rb
redcar-0.3.1dev lib/logging/test/config/test_configurator.rb