module GemHadar::SimpleCov

def start(profile = nil, &block)

Parameters:
  • block (Proc, nil) -- optional block containing custom configuration
  • profile (String, nil) -- the SimpleCov profile to use for
def start(profile = nil, &block)
  if ENV['START_SIMPLECOV'].to_i != 1
    STDERR.puts color(226) {
      "Skip starting Simplecov for code coverage, "\
      "enable by setting env var: START_SIMPLECOV=1"
    }
    return
  end
  require 'simplecov'
  STDERR.puts color(76) { "Configuring Simplecov for code coverage." }
  block ||= default_block
  SimpleCov.start(profile, &block)
rescue LoadError => e
  warn "Caught #{e.class}: #{e}"
  STDERR.puts "Install with: gem install simplecov"
end