Skip to content

Commit

Permalink
Merge pull request #1 from LaunchPadLab/bugfix/linecoverage
Browse files Browse the repository at this point in the history
Bugfix/linecoverage
  • Loading branch information
inveterateliterate authored Mar 21, 2022
2 parents 2d86571 + f0c132d commit ce5ca7b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/simplecov_small_badge/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def percent_text(percent)
end

def state(covered_percent)
if line_coverage_minimum&.positive?
if covered_percent >= line_coverage_minimum
if coverage_minimum&.positive?
if covered_percent >= coverage_minimum
'good'
else
'bad'
Expand All @@ -44,9 +44,11 @@ def state(covered_percent)
end
end

def line_coverage_minimum
minimums = SimpleCov.minimum_coverage
minimums.is_a?(Hash) ? minimums[:line] : minimums
def coverage_minimum
@coverage_minimum ||= begin
minimums = SimpleCov.minimum_coverage
minimums.is_a?(Hash) ? minimums[SimpleCov.primary_coverage] : minimums
end
end

def map_image_config(state)
Expand Down

0 comments on commit ce5ca7b

Please sign in to comment.