Sha256: be315f35e2a633c2f2bf632f8ec5837e1c157339858af65a32749cdfa3a97a63

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

# Load default formatter gem
require 'simplecov-html'

SimpleCov.adapters.define 'root_filter' do
  # Exclude all files outside of simplecov root
  add_filter do |src|
    !(src.filename =~ /^#{SimpleCov.root}/)
  end
end

SimpleCov.adapters.define 'test_frameworks' do
  add_filter '/test/'
  add_filter '/features/'
  add_filter '/spec/'
  add_filter '/autotest/'
end

SimpleCov.adapters.define 'rails' do
  load_adapter 'test_frameworks'

  add_filter '/config/'
  add_filter '/db/'
  add_filter '/vendor/bundle/'

  add_group 'Controllers', 'app/controllers'
  add_group 'Models', 'app/models'
  add_group 'Helpers', 'app/helpers'
  add_group 'Libraries', 'lib'
  add_group 'Plugins', 'vendor/plugins'
end

# Default configuration
SimpleCov.configure do
  formatter SimpleCov::Formatter::HTMLFormatter
  # Exclude files outside of SimpleCov.root
  load_adapter 'root_filter'
end

at_exit do
  # Store the exit status of the test run since it goes away after calling the at_exit proc...
  @exit_status = $!.status if $!.is_a?(SystemExit)
  SimpleCov.at_exit.call
  exit @exit_status if @exit_status # Force exit with stored status (see github issue #5)
end

# Autoload config from .simplecov if present
config_path = File.join(SimpleCov.root, '.simplecov')
load config_path if File.exist?(config_path)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplecov-0.5.3 lib/simplecov/defaults.rb
simplecov-0.5.2 lib/simplecov/defaults.rb