Skip to content

Commit

Permalink
Remove branch coverage workaround, no longer needed in Ruby 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Dec 15, 2021
1 parent a7b9fc4 commit ea04fd3
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,53 +23,9 @@
def SimpleCov.rodauth_coverage(opts = {})
start do
enable_coverage :branch

# Work around Ruby Bug #16967
Coverage.singleton_class.prepend(Module.new do
def result
res = super
check_branch = true
skip_2nd = lambda do |ary|
ary = ary.dup
ary.slice!(1)
ary
end
res.values.each do |hash|
if check_branch
unless hash.is_a?(Hash) && hash[:branches]
return res
end
check_branch = false
end
unique_branches = {}
branch_counters = {}
new_branches = {}
branches = hash[:branches]
branches.each do |k, v|
new_k = skip_2nd[k]
if branch_values = unique_branches[new_k]
v.each do |k1, v1|
branch_counters[skip_2nd[k1]] += v1
end
branch_values.keys.each do |k1|
branch_values[k1] = branch_counters[skip_2nd[k1]]
end
else
unique_branches[new_k] = new_branches[k] = v
v.each do |k1, v1|
branch_counters[skip_2nd[k1]] = v1
end
end
end
hash[:branches] = new_branches
end
res
end
end)
add_filter "/spec/"
add_group('Missing'){|src| src.covered_percent < 100}
add_group('Covered'){|src| src.covered_percent == 100}
yield self if block_given?
end
end

Expand Down

0 comments on commit ea04fd3

Please sign in to comment.