Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/linecoverage #1

Merged
merged 2 commits into from
Mar 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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