Skip to content

Commit 41f1eca

Browse files
committed
Add test coverage reporting to Coveralls
1 parent 57cf085 commit 41f1eca

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ source "https://rubygems.org"
22

33
gemspec
44

5+
gem "coveralls_reborn", require: false
56
gem "factory_bot"
67
gem "rake", "~> 13.0"
78
gem "rspec", "~> 3.0"
89
gem "rubocop"
910
gem "rubocop-factory_bot"
1011
gem "rubocop-rake"
1112
gem "rubocop-rspec"
13+
gem "simplecov", require: false
14+
gem "simplecov-lcov", require: false

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# S2 Ruby
22

3-
[![Tests](https://github.com/stekker/s2-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/stekker/s2-ruby/actions/workflows/ci.yml)
43
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.txt)
54
[![Ruby](https://img.shields.io/badge/Ruby-3.3+-red.svg)](s2-ruby.gemspec)
5+
[![Tests](https://github.com/stekker/s2-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/stekker/s2-ruby/actions/workflows/ci.yml)
6+
[![Coverage Status](https://coveralls.io/repos/github/stekker/s2-ruby/badge.svg?branch=main)](https://coveralls.io/github/stekker/s2-ruby?branch=main)
67

78
Ruby implementation of the [S2 standard](https://s2standard.org/) (EN 50491-12-2) for smart grid energy flexibility.
89

spec/spec_helper.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
require "simplecov"
2+
require "simplecov-lcov"
3+
4+
SimpleCov::Formatter::LcovFormatter.config do |config|
5+
config.report_with_single_file = true
6+
config.single_report_path = "coverage/lcov.info"
7+
end
8+
9+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
10+
[
11+
SimpleCov::Formatter::HTMLFormatter,
12+
SimpleCov::Formatter::LcovFormatter,
13+
],
14+
)
15+
16+
SimpleCov.start do
17+
add_filter "/spec/"
18+
enable_coverage :branch
19+
end
20+
21+
require "coveralls"
22+
Coveralls.wear! if ENV["CI"]
23+
124
require "rspec"
225
require "factory_bot"
326
require "s2"

0 commit comments

Comments
 (0)