diff --git a/test/test_filters.rb b/test/test_filters.rb index da44e071..8d363066 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -37,10 +37,14 @@ class TestFilters < Minitest::Test context "with no filters set up and a basic source file in an array" do setup do - SimpleCov.filters = [] + @prev_filters, SimpleCov.filters = SimpleCov.filters, [] @files = [SimpleCov::SourceFile.new(source_fixture('sample.rb'), [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil])] end + teardown do + SimpleCov.filters = @prev_filters + end + should "return 0 items after executing SimpleCov.filtered on files when using a 'sample' string filter" do SimpleCov.add_filter "sample" assert_equal 0, SimpleCov.filtered(@files).count diff --git a/test/test_result.rb b/test/test_result.rb index 83105d29..5535ce69 100644 --- a/test/test_result.rb +++ b/test/test_result.rb @@ -3,14 +3,21 @@ class TestResult < Minitest::Test context "With a (mocked) Coverage.result" do setup do - SimpleCov.filters = [] - SimpleCov.groups = {} - SimpleCov.formatter = nil + @prev_filters, SimpleCov.filters = SimpleCov.filters, [] + @prev_groups, SimpleCov.groups = SimpleCov.groups, {} + @prev_formatter, SimpleCov.formatter = SimpleCov.formatter, nil + @original_result = {source_fixture('sample.rb') => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil], source_fixture('app/models/user.rb') => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil], source_fixture('app/controllers/sample_controller.rb') => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil]} end + teardown do + SimpleCov.filters = @prev_filters + SimpleCov.groups = @prev_groups + SimpleCov.formatter = @prev_formatter + end + context "a simple cov result initialized from that" do setup { @result = SimpleCov::Result.new(@original_result) }