10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/slather/coverage_service/simple_output.rb', line 10
def post
total_project_lines = 0
total_project_lines_tested = 0
coverage_files.each do |coverage_file|
coverage_data = coverage_file.coverage_data.compact
lines_tested = coverage_data.select { |cd| cd > 0 }.count
total_lines = coverage_data.count
percentage = '%.2f' % [(lines_tested / total_lines.to_f) * 100.0]
total_project_lines_tested += lines_tested
total_project_lines += total_lines
puts "#{coverage_file.source_file_pathname_relative_to_repo_root}: #{lines_tested} of #{total_lines} lines (#{percentage}%)"
end
total_percentage = '%.2f' % [(total_project_lines_tested / total_project_lines.to_f) * 100.0]
puts "Test Coverage: #{total_percentage}%"
end
|