Sha256: 3c0d0951ed173db8407d3cb6cafc875be4c21b576cdcdf095ae0f4db607eb5db
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
require "simplecov-rcov-text" require "colorized_text" include ColorizedText SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::RcovTextFormatter, SimpleCov::Formatter::HTMLFormatter ] SimpleCov.start do add_filter "/spec/" add_filter "/config/" # Fail the build when coverage is weak: at_exit do SimpleCov.result.format! threshold, actual = 95.121, SimpleCov.result.covered_percent if actual < threshold msg = "\nLow coverage: " msg << red("#{actual}%") msg << " is #{red 'under'} the threshold: " msg << green("#{threshold}%.") msg << "\n" $stderr.puts msg exit 1 else # Precision: three decimal places: actual_trunc = (actual * 1000).floor / 1000.0 msg = "\nCoverage: " msg << green("#{actual}%") msg << " is #{green 'over'} the threshold: " if actual_trunc > threshold msg << bold(yellow("#{threshold}%. ")) msg << "Please update the threshold to: " msg << bold(green("#{actual_trunc}% ")) msg << "in ./.simplecov." else msg << green("#{threshold}%.") end msg << "\n" $stdout.puts msg end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_shipping-0.4.7 | .simplecov |
simple_shipping-0.4.6 | .simplecov |