simplecov-markdown 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/simplecov-markdown/version.rb +1 -2
- data/lib/simplecov-markdown.rb +18 -4
- data/spec/fixtures/report.md.erb +7 -4
- data/spec/simplecov-markdown_spec.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca464ea526ad147010d6d28ac244d0f6320ed432
|
4
|
+
data.tar.gz: 39669c96b05fc0890a2315e7779a0148fc6a9460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca2d615c435bce00362b656c8a39154a1a88357dd57eb482d6176ba0bd555adcf72b1cf6d11145cd54894cb6dd9a52083883854487cb162c8e8e890ec55834f0
|
7
|
+
data.tar.gz: d661169acffbcee937a368eadd5ca810f679d8c11f177170e6eb87bd144a72e7180da6c0f8984a3ef93aa0afad610ed5875c4f29c2ebe261735b5016be43629a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
SimpleCov Markdown Formatter
|
2
2
|
==================================
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/simplecov-markdown.svg)](http://badge.fury.io/rb/simplecov-markdown)
|
4
5
|
[![Build Status](https://travis-ci.org/holyshared/simplecov-markdown.svg?branch=master)](https://travis-ci.org/holyshared/simplecov-markdown)
|
5
6
|
[![Coverage Status](https://coveralls.io/repos/holyshared/simplecov-markdown/badge.png)](https://coveralls.io/r/holyshared/simplecov-markdown)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/holyshared/simplecov-markdown/badges/gpa.svg)](https://codeclimate.com/github/holyshared/simplecov-markdown)
|
6
8
|
|
7
9
|
Install
|
8
10
|
----------------------------
|
data/lib/simplecov-markdown.rb
CHANGED
@@ -4,6 +4,7 @@ class SimpleCov::Formatter::MarkdownFormatter
|
|
4
4
|
def format(result)
|
5
5
|
report_writer = ReportWriter.new(SimpleCov::Formatter::MarkdownFormatter.output_path)
|
6
6
|
report_writer.write_header "Code Coverage Report"
|
7
|
+
report_writer.write_description(result)
|
7
8
|
report_writer.write_result(result)
|
8
9
|
report_writer.destroy!
|
9
10
|
end
|
@@ -21,13 +22,26 @@ class SimpleCov::Formatter::MarkdownFormatter
|
|
21
22
|
|
22
23
|
def write_header(title)
|
23
24
|
@report.puts title
|
24
|
-
@report.puts "=" * 20
|
25
|
+
@report.puts "=" * 20
|
26
|
+
@report.puts "\n"
|
27
|
+
end
|
28
|
+
|
29
|
+
def write_description(result)
|
30
|
+
@report.puts "Project name: " + SimpleCov.project_name
|
31
|
+
@report.puts "Created at: " + result.created_at.to_s
|
32
|
+
@report.puts "\n"
|
25
33
|
end
|
26
34
|
|
27
35
|
def write_result(result)
|
28
36
|
@table_writer.write_header
|
29
37
|
result.files.each do |file|
|
30
|
-
@table_writer.write_record(
|
38
|
+
@table_writer.write_record(
|
39
|
+
file.filename,
|
40
|
+
file.covered_percent.round(2).to_s + "%",
|
41
|
+
file.covered_lines.size,
|
42
|
+
file.missed_lines.size,
|
43
|
+
file.lines_of_code
|
44
|
+
)
|
31
45
|
end
|
32
46
|
@table_writer.destroy!
|
33
47
|
end
|
@@ -43,8 +57,8 @@ class SimpleCov::Formatter::MarkdownFormatter
|
|
43
57
|
|
44
58
|
def initialize(report)
|
45
59
|
@report = report
|
46
|
-
@columns_headers = ["File", "Coverage"]
|
47
|
-
@columns_header_aligns = [:left, :right]
|
60
|
+
@columns_headers = ["File", "Coverage", "Covered", "Missed", "Total"]
|
61
|
+
@columns_header_aligns = [:left, :right, :right, :right, :right]
|
48
62
|
end
|
49
63
|
|
50
64
|
def write_header
|
data/spec/fixtures/report.md.erb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
Code Coverage Report
|
2
2
|
====================
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
Project name: <%= project_name %>
|
5
|
+
Created at: <%= created_at %>
|
6
|
+
|
7
|
+
|File|Coverage|Covered|Missed|Total|
|
8
|
+
|:--|--:|--:|--:|--:|
|
9
|
+
|<%= root_directory %>/fixtures/sample1.rb|100.0%|5|0|5|
|
10
|
+
|<%= root_directory %>/fixtures/sample2.rb|80.0%|4|1|5|
|
@@ -12,6 +12,8 @@ describe 'MarkdownFormatter' do
|
|
12
12
|
let(:report_path) { File.join(temp_dir_path, 'report.md') }
|
13
13
|
let(:expect_report) do
|
14
14
|
root_directory = File.dirname(__FILE__)
|
15
|
+
project_name = SimpleCov.project_name
|
16
|
+
created_at = result.created_at
|
15
17
|
erb_script = File.open(File.join(File.dirname(__FILE__), 'fixtures/report.md.erb')).read
|
16
18
|
ERB.new(erb_script).result(binding)
|
17
19
|
end
|