Skip to content

Commit dc2d2a9

Browse files
authored
Code coverage (#10)
1 parent 97ef55a commit dc2d2a9

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

.circleci/config.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,19 @@ jobs:
77
steps:
88
- checkout
99
- run: bundle install
10-
- run: bundle exec rake test
11-
- run: bundle exec rubocop
10+
- run:
11+
name: Setup Code Climate test-reporter
12+
command: |
13+
# download test reporter as a static binary
14+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
15+
chmod +x ./cc-test-reporter
16+
- run:
17+
name: rake test
18+
command: |
19+
./cc-test-reporter before-build
20+
bundle exec rake test
21+
./cc-test-reporter after-build --coverage-input-type lcov --exit-code $?
22+
- run:
23+
name: rubocop
24+
command: bundle exec rubocop
25+
when: always

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Style/Documentation:
99
Metrics/MethodLength:
1010
Exclude:
1111
- test/**/*_test.rb
12+
TrailingCommaInArrayLiteral:
13+
EnforcedStyleForMultiline: consistent_comma
1214
Style/TrailingCommaInArguments:
1315
EnforcedStyleForMultiline: consistent_comma
1416
Style/AccessorGrouping:

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ gemspec
88
gem 'minitest', '~> 5.0'
99
gem 'rake', '~> 13.0'
1010
gem 'rubocop', '~> 0.88.0'
11+
gem 'simplecov', '~> 0.17.0', require: false # CodeClimate not compatible with 0.18+ yet - https://github.com/codeclimate/test-reporter/issues/413
12+
gem 'simplecov-lcov', '< 0.8'

test/test_helper.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# frozen_string_literal: true
22

3+
require 'simplecov'
4+
require 'simplecov-lcov'
5+
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
6+
SimpleCov::Formatter::LcovFormatter.config do |c|
7+
c.single_report_path = 'coverage/lcov.info'
8+
end
9+
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
10+
[
11+
SimpleCov::Formatter::HTMLFormatter,
12+
SimpleCov::Formatter::LcovFormatter,
13+
],
14+
)
15+
SimpleCov.start
16+
317
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
418
require 'diffcrypt'
519

0 commit comments

Comments
 (0)