Skip to content

Commit 92ebc37

Browse files
committed
display branch coverage percentage and line coverage for consistency
1 parent ae32aa0 commit 92ebc37

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PATH
66
PATH
77
remote: /home/tobi/github/simplecov
88
specs:
9-
simplecov (0.18.0.beta2)
9+
simplecov (0.18.0.beta3)
1010
docile (~> 1.1)
1111
simplecov-html (~> 0.11.0.beta2)
1212

lib/simplecov-html.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ def formatted_file_list(title, source_files)
9090
template("file_list").result(binding)
9191
end
9292

93+
def covered_percent(percent)
94+
template("covered_percent").result(binding)
95+
end
96+
9397
def coverage_css_class(covered_percent)
9498
if covered_percent > 90
9599
"green"

views/covered_percent.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<span class="<%= coverage_css_class(percent) %>">
2+
<%= percent.round(2) %>%
3+
</span>

views/file_list.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
<h2>
33
<span class="group_name"><%= title %></span>
44
(<span class="covered_percent">
5-
<span class="<%= coverage_css_class(source_files.covered_percent) %>">
6-
<%= source_files.covered_percent.round(2) %>%
7-
</span>
5+
<%= covered_percent(source_files.covered_percent) %>
86
</span>
97
covered at
108
<span class="covered_strength">
@@ -25,13 +23,15 @@
2523
<b><%= source_files.lines_of_code %></b> relevant lines,
2624
<span class="green"><b><%= source_files.covered_lines %></b> lines covered</span> and
2725
<span class="red"><b><%= source_files.missed_lines %></b> lines missed. </span>
26+
(<%= covered_percent(source_files.covered_percent) %>)
2827
</div>
2928

3029
<% if branchable_result? %>
3130
<div class="t-branch-summary">
3231
<span><b><%= source_files.total_branches %></b> total branches, </span>
3332
<span class="green"><b><%= source_files.covered_branches %></b> branches covered</span> and
3433
<span class="red"><b><%= source_files.missed_branches %></b> branches missed.</span>
34+
(<%= covered_percent(source_files.branches_coverage_percent) %>)
3535
</div>
3636
<% end %>
3737

0 commit comments

Comments
 (0)