Sha256: 7f6d67e3adb2eda3e143e9b55b1362e30b3bd80d03440e81aef3ada6f8503972

Contents?: true

Size: 913 Bytes

Versions: 53

Compression:

Stored size: 913 Bytes

Contents

require File.expand_path('setup', File.dirname(__FILE__))

module TestLogging

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

    def setup
      super

      ::Logging::init
      @lf = ::Logging::Filters::Level.new :debug, :warn
    end

    def test_level_filter_includes_selected_level
      debug_evt = event_for_level(:debug)
      warn_evt = event_for_level(:warn)
      assert_same debug_evt, @lf.allow(debug_evt), "Debug messages should be allowed"
      assert_same warn_evt, @lf.allow(warn_evt), "Warn messages should be allowed"
    end

    def test_level_filter_excludes_unselected_level
      event = event_for_level(:info)
      assert_nil @lf.allow(event), "Info messages should be disallowed"
    end

    def event_for_level(level)
      ::Logging::LogEvent.new('logger', ::Logging::LEVELS[level.to_s],
                              'message', false)
    end

  end
end

Version data entries

53 entries across 45 versions & 4 rubygems

Version Path
logging-2.4.0 test/test_filter.rb
logging-2.3.1 test/test_filter.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/test/test_filter.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/test/test_filter.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/test/test_filter.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/logging-2.3.0/test/test_filter.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/test/test_filter.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/logging-2.3.0/test/test_filter.rb
logging-2.3.0 test/test_filter.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/test_filter.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/test_filter.rb