Sha256: e3e7e53b3def8700da788f14f9d29ef6f4ec8dd4d9b013a916aaadc2d790ccc5

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

require_relative "../../test_helper"

module MinitestReportersTest
  class ExtensibleBacktraceFilterTest < TestCase
    def setup
      @default_filter = Minitest::ExtensibleBacktraceFilter.default_filter
      @filter = Minitest::ExtensibleBacktraceFilter.new
      @backtrace = ["foo", "bar", "baz"]
    end

    def test_adding_filters
      @filter.add_filter(/foo/)
      assert @filter.filters?("foo")
      refute @filter.filters?("baz")
    end

    def test_filter_backtrace_when_first_line_is_filtered
      @filter.add_filter(/foo/)
      assert_equal ["bar", "baz"], @filter.filter(@backtrace)
    end

    def test_filter_backtrace_when_middle_line_is_filtered
      @filter.add_filter(/bar/)
      assert_equal ["foo"], @filter.filter(@backtrace)
    end

    def test_filter_backtrace_when_all_lines_are_filtered
      @filter.add_filter(/./)
      assert_equal ["foo", "bar", "baz"], @filter.filter(@backtrace)
    end

    def test_default_filter
      assert @default_filter.filters?("lib/minitest")
      assert @default_filter.filters?("lib/minitest/reporters")
      refute @default_filter.filters?("lib/my_gem")
    end

    def test_nil_backtrace
      assert_equal [], @filter.filter(nil)
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
minitest-reporters-1.3.6 test/unit/minitest/extensible_backtrace_filter_test.rb
nullifyable-0.1.0 vendor/bundle/gems/minitest-reporters-1.3.5/test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.5 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.5.beta1 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.4 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.3 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.2 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.2.beta2 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.2.beta1 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.1 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-1.3.1.beta1 test/unit/minitest/extensible_backtrace_filter_test.rb