Sha256: 0ff5660fe90ee91b4fbd05acde04a4dd2e2c45781f2f026fd97751f66921b844
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require "coverage/kit/version" module Coverage module Kit def self.setup(minimum_coverage: ) return if ENV['COVERAGE'] == 'off' @minimum_coverage = minimum_coverage @maximum_coverage = @minimum_coverage + 0.5 require 'simplecov' Coveralls.wear! if defined?(Coveralls) formatters = [] formatters << SimpleCov::Formatter::RcovFormatter if defined?(SimpleCov::Formatter::RcovFormatter) formatters << Coveralls::SimpleCov::Formatter if defined?(Coveralls) SimpleCov.formatters = formatters SimpleCov.start do add_filter '/vendor/' add_filter '/config/' add_filter '/spec/' add_group 'lib', 'lib' end SimpleCov.at_exit do SimpleCov.result.format! percent = SimpleCov.result.covered_percent puts "Coverage is #{'%.2f' % percent} (min: #{@minimum_coverage})" if percent < @minimum_coverage puts "Coverage must be above #{@minimum_coverage}" Kernel.exit(1) elsif percent > @maximum_coverage puts "Coverage must be below #{@maximum_coverage}. Time to bump coverage!" Kernel.exit(1) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coverage-kit-0.1.0 | lib/coverage/kit.rb |