view modules/mysql/spec/spec_helper_local.rb @ 333:8d8dd5c4ec0e

Check sender access earlier to allow whitelisting This is important for some hosts who send from a domain that doesn't have DNS, but that we want to allow
author IBBoard <dev@ibboard.co.uk>
date Sun, 15 Mar 2020 16:51:56 +0000
parents 48d3a1948e4d
children
line wrap: on
line source

require 'rspec-puppet-facts'
include RspecPuppetFacts

if ENV['COVERAGE'] == 'yes'
  require 'simplecov'
  require 'simplecov-console'
  require 'codecov'

  SimpleCov.formatters = [
    SimpleCov::Formatter::HTMLFormatter,
    SimpleCov::Formatter::Console,
    SimpleCov::Formatter::Codecov,
  ]
  SimpleCov.start do
    track_files 'lib/**/*.rb'

    add_filter '/spec'

    # do not track vendored files
    add_filter '/vendor'
    add_filter '/.vendor'

    # do not track gitignored files
    # this adds about 4 seconds to the coverage check
    # this could definitely be optimized
    add_filter do |f|
      # system returns true if exit status is 0, which with git-check-ignore means file is ignored
      system("git check-ignore --quiet #{f.filename}")
    end
  end
end