File tree Expand file tree Collapse file tree 3 files changed +9
-36
lines changed Expand file tree Collapse file tree 3 files changed +9
-36
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ branches:
1414matrix :
1515 include :
1616 - rvm : 2.4.3
17- env : PUPPET_GEM_VERSION='~> 5' COVERAGE =yes # 5.5
18- - env : RVM="jruby-1.7.26" PUPPET_GEM_VERSION='~> 5' JRUBY_OPTS="--debug" COVERAGE =yes
17+ env : PUPPET_GEM_VERSION='~> 5' SIMPLECOV =yes # 5.5
18+ - env : RVM="jruby-1.7.26" PUPPET_GEM_VERSION='~> 5' JRUBY_OPTS="--debug" SIMPLECOV =yes
1919 before_cache : pushd ~/.rvm && rm -rf archives rubies/ruby-2.2.7 rubies/ruby-2.3.4 && popd
2020 cache :
2121 bundler : true
@@ -45,7 +45,7 @@ matrix:
4545 - rvm : 2.4.1
4646 env : PUPPET_GEM_VERSION='~> 5.0.0'
4747 - rvm : 2.1.9
48- env : PUPPET_GEM_VERSION='~> 4' COVERAGE =yes # 4.10
48+ env : PUPPET_GEM_VERSION='~> 4' SIMPLECOV =yes # 4.10
4949 - rvm : 2.1.9
5050 env : PUPPET_GEM_VERSION='~> 4.9.0'
5151 - rvm : 2.1.9
Original file line number Diff line number Diff line change 2727namespace :spec do
2828 desc 'Run RSpec code examples with coverage collection'
2929 task :coverage do
30- ENV [ 'COVERAGE ' ] = 'yes'
30+ ENV [ 'SIMPLECOV ' ] = 'yes'
3131 Rake ::Task [ 'spec' ] . execute
3232 end
3333end
Original file line number Diff line number Diff line change 1- if ENV [ 'COVERAGE' ] == 'yes'
2- require 'simplecov'
3- require 'simplecov-console'
4- require 'codecov'
5-
6- SimpleCov . formatters = [
7- SimpleCov ::Formatter ::HTMLFormatter ,
8- SimpleCov ::Formatter ::Console ,
9- SimpleCov ::Formatter ::Codecov ,
10- ]
11- SimpleCov . start do
12- track_files 'lib/**/*.rb'
13-
14- add_filter 'lib/puppet/resource_api/version.rb'
15-
16- add_filter '/spec'
17-
18- # do not track vendored files
19- add_filter '/vendor'
20- add_filter '/.vendor'
21-
22- # do not track gitignored files
23- # this adds about 4 seconds to the coverage check
24- # this could definitely be optimized
25- add_filter do |f |
26- # system returns true if exit status is 0, which with git-check-ignore means file is ignored
27- system ( "git check-ignore --quiet #{ f . filename } " )
28- end
29- end
30- end
31-
321require 'bundler/setup'
33- require 'puppet/resource_api'
342
353RSpec . configure do |config |
364 # Enable flags like --only-failures and --next-failure
4715 config . mock_with :rspec
4816end
4917
18+ # load puppet spec support and coverage setup before loading our code
5019require 'puppetlabs_spec_helper/module_spec_helper'
20+ require 'puppet/resource_api'
21+
22+ # exclude the `version.rb` which already gets loaded by bundler via the gemspec, and doesn't need coverage testing anyways.
23+ SimpleCov . add_filter 'lib/puppet/resource_api/version.rb' if ENV [ 'SIMPLECOV' ] == 'yes'
You can’t perform that action at this time.
0 commit comments