Module: RSpec::Support::Spec
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Defined in: | rspec-support/lib/rspec/support/spec.rb, rspec-support/lib/rspec/support/spec/diff_helpers.rb |
Class Method Summary
Class Method Details
.setup_simplecov(&block)
[ GitHub ]# File 'rspec-support/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
.start_simplecov(&block) (private)
[ GitHub ]# File 'rspec-support/lib/rspec/support/spec.rb', line 68
def self.start_simplecov(&block) SimpleCov.start do add_filter "bundle/" add_filter "tmp/" add_filter do |source_file| # Filter out `spec` directory except when it is under `lib` # (as is the case in rspec-support) source_file.filename.include?('/spec/') && !source_file.filename.include?('/lib/') end instance_eval(&block) if block end end