diff --git a/.gitignore b/.gitignore index dae4b21..f63679d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ Gemfile.lock ## MODULE BUILDS **/pkg -## RubyMine +## RubyMine /.idea/ ## rvm/rbenv @@ -38,3 +38,6 @@ Gemfile.lock /log/ /*.gem /spec/acceptance/nodesets/ + +## local coverage results +/coverage/ diff --git a/.travis.yml b/.travis.yml index 88a4e09..cd49020 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,4 +27,4 @@ matrix: - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop -script: 'SPEC_OPTS="--format documentation" bundle exec rake $CHECK' +script: 'SPEC_OPTS="--format documentation" COVERAGE="yes" bundle exec rake $CHECK' diff --git a/Gemfile b/Gemfile index 8c2bd55..8823c7f 100644 --- a/Gemfile +++ b/Gemfile @@ -13,10 +13,12 @@ else end group :test do - gem "rspec", "~> 3.1" + gem 'codecov' gem 'mocha' gem 'puppetlabs_spec_helper' gem 'serverspec' + gem 'simplecov-console' + gem "rspec", "~> 3.1" end group :acceptance do diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..fd43b71 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,3 @@ +--- +# disable comments, info can be gotten from the pr status updates, and the comment editing spams the hipchat notifications +comment: false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0b616ea..a203858 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,20 @@ +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' + end +end + require 'mocha' require 'rspec' require 'puppet/version' @@ -21,4 +38,3 @@ RSpec.configure do |config| YARD::Registry.clear end end -