Skip to content

Commit 8497009

Browse files
committed
Use SimpleCov.add_filter block instead of string
Using a string is almost always a bad idea, because if any part of the path contains the string, it will filter out the path. Switch to using a block and doing a match on the entire path prefix.
1 parent 6afaeb9 commit 8497009

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spec/coverage_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
enable_coverage :branch
55
command_name ENV['SIMPLECOV_COMMAND_NAME']
66
root File.dirname(__dir__)
7-
add_filter "/spec/"
7+
add_filter{|f| f.filename.match(%r{\A#{Regexp.escape(File.dirname(__FILE__))}/})}
88
add_group('Missing'){|src| src.covered_percent < 100}
99
add_group('Covered'){|src| src.covered_percent == 100}
1010
end

0 commit comments

Comments
 (0)