Sha256: 1de1dbb777c2db903ec5a4a475edb0709043b3b11f220c255499c883605051a1

Contents?: true

Size: 1.13 KB

Versions: 26

Compression:

Stored size: 1.13 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
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
minitest-reporters-0.14.20 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.19 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.18 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.17 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.16 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.15 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.14 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.13 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.12 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.11 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.10 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.9 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.8 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.7 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.6 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.5 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.4 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.3 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.2 test/unit/minitest/extensible_backtrace_filter_test.rb
minitest-reporters-0.14.1 test/unit/minitest/extensible_backtrace_filter_test.rb