2021-02-09 16:25:38 +00:00
|
|
|
# Code coverage (via SimpleCov)
|
|
|
|
begin
|
|
|
|
require "simplecov"
|
|
|
|
SimpleCov.start do
|
|
|
|
add_filter "/spec/" # exclude test code
|
2021-05-06 19:42:28 +00:00
|
|
|
add_filter "/vendor/" # exclude gems which are cached in CI
|
2021-02-09 16:25:38 +00:00
|
|
|
end
|
2015-06-24 20:00:41 +00:00
|
|
|
|
2021-05-07 13:49:58 +00:00
|
|
|
# On CI we publish coverage to codecov.io
|
|
|
|
# To use codecov-action, we need to generate XML based covarage report
|
|
|
|
if ENV["CI"] == "true"
|
|
|
|
require "simplecov-cobertura"
|
|
|
|
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
2015-06-24 20:18:43 +00:00
|
|
|
end
|
2021-02-09 16:25:38 +00:00
|
|
|
|
|
|
|
# Due to circular dependency (simplecov depends on docile), remove docile and require again below
|
|
|
|
Object.send(:remove_const, :Docile)
|
2021-05-07 23:27:30 +00:00
|
|
|
$LOADED_FEATURES.reject! { |f| f =~ /\/lib\/docile/ }
|
2021-02-09 16:25:38 +00:00
|
|
|
rescue LoadError
|
|
|
|
warn "warning: simplecov or codecov gems not found; skipping coverage"
|
2014-02-21 20:10:13 +00:00
|
|
|
end
|
2011-12-06 19:46:46 +00:00
|
|
|
|
2018-01-14 23:55:16 +00:00
|
|
|
lib_dir = File.join(File.dirname(File.dirname(__FILE__)), "lib")
|
2014-02-21 20:10:13 +00:00
|
|
|
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir
|
2011-12-06 19:46:46 +00:00
|
|
|
|
2021-02-09 16:25:38 +00:00
|
|
|
# Require Docile again, now with coverage enabled
|
2018-01-14 23:55:16 +00:00
|
|
|
require "docile"
|