Skip to content

Commit 076fefc

Browse files
committed
added simplecov for measuring test coverage
1 parent fb56031 commit 076fefc

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.rspec_status
33
.yardoc
44
*.yml
5+
coverage
56
doc
67
example/*.json
78
Gemfile.lock

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ gem 'yard'
1414
gem 'rspec', '~> 3.12'
1515
gem 'fakefs', '~> 1.8'
1616
gem 'webmock', '~> 3.19'
17+
gem 'simplecov'

spec/spec_helper.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
require 'simplecov'
2+
3+
SimpleCov.start do
4+
enable_coverage :branch
5+
add_filter "/spec/"
6+
end
7+
18
require 'minisky'
29
require 'pp' # needs to be included before fakefs
310

@@ -14,3 +21,22 @@
1421
c.syntax = [:should, :expect]
1522
end
1623
end
24+
25+
module SimpleCov
26+
module Formatter
27+
class HTMLFormatter
28+
def format(result)
29+
# silence the stdout summary, just save the html files
30+
unless @inline_assets
31+
Dir[File.join(@public_assets_dir, "*")].each do |path|
32+
FileUtils.cp_r(path, asset_output_path, remove_destination: true)
33+
end
34+
end
35+
36+
File.open(File.join(output_path, "index.html"), "wb") do |file|
37+
file.puts template("layout").result(binding)
38+
end
39+
end
40+
end
41+
end
42+
end

0 commit comments

Comments
 (0)