Module: RSpec::Support::Spec

Defined in:
lib/rspec/support/spec.rb,
lib/rspec/support/spec/diff_helpers.rb

Defined Under Namespace

Modules: DiffHelpers

Class Method Summary collapse

Class Method Details

.setup_simplecov(&block) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/rspec/support/spec.rb', line 49

def self.setup_simplecov(&block)
  # Simplecov emits some ruby warnings when loaded, so silence them.
  old_verbose, $VERBOSE = $VERBOSE, false

  return if ENV['NO_COVERAGE'] || RUBY_VERSION < '1.9.3'
  return if RUBY_ENGINE != 'ruby' || RSpec::Support::OS.windows?

  # Don't load it when we're running a single isolated
  # test file rather than the whole suite.
  return if RSpec.configuration.files_to_run.one?

  require 'simplecov'
  start_simplecov(&block)
rescue LoadError
  warn "Simplecov could not be loaded"
ensure
  $VERBOSE = old_verbose
end