aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGarrett Honeycutt <code@garretthoneycutt.com>2020-02-11 16:24:51 -0500
committerGitHub <noreply@github.com>2020-02-11 16:24:51 -0500
commit05997e0d9e30ba0e53dead0ace65121801c03d7f (patch)
tree4cdeb3f5c8e3d12e0ebb7cc2907b2e78940f85eb /spec
parent76833ebc2f9313afb3f36d37b351933c06b112f2 (diff)
parentbe298bed6169c9f59148042af47e12faffe48881 (diff)
downloadpuppet-ferm-05997e0d9e30ba0e53dead0ace65121801c03d7f.tar.gz
puppet-ferm-05997e0d9e30ba0e53dead0ace65121801c03d7f.tar.bz2
Merge pull request #94 from voxpupuli/modulesync
modulesync 3.0.0
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb51
1 files changed, 4 insertions, 47 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 93f417a..b2b2704 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,19 +1,12 @@
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
-RSpec.configure do |c|
- c.mock_with :rspec
-end
-require 'puppetlabs_spec_helper/module_spec_helper'
-require 'rspec-puppet-facts'
-require 'bundler'
-include RspecPuppetFacts
+# puppetlabs_spec_helper will set up coverage if the env variable is set.
+# We want to do this if lib exists and it hasn't been explicitly set.
+ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__))
-if ENV['DEBUG']
- Puppet::Util::Log.level = :debug
- Puppet::Util::Log.newdestination(:console)
-end
+require 'voxpupuli/test/spec_helper'
if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml')))
@@ -23,39 +16,3 @@ if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
end
end
end
-
-if Dir.exist?(File.expand_path('../../lib', __FILE__))
- require 'coveralls'
- require 'simplecov'
- require 'simplecov-console'
- SimpleCov.formatters = [
- SimpleCov::Formatter::HTMLFormatter,
- SimpleCov::Formatter::Console
- ]
- SimpleCov.start do
- track_files 'lib/**/*.rb'
- add_filter '/spec'
- add_filter '/vendor'
- add_filter '/.vendor'
- add_filter Bundler.configured_bundle_path.path
- end
-end
-
-RSpec.configure do |c|
- # getting the correct facter version is tricky. We use facterdb as a source to mock facts
- # see https://github.com/camptocamp/facterdb
- # people might provide a specific facter version. In that case we use it.
- # Otherwise we need to match the correct facter version to the used puppet version.
- # as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14
- # https://puppet.com/docs/puppet/5.5/about_agent.html
- c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
- ENV['FACTERDB_FACTS_VERSION']
- else
- Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0'
- end
-
- # Coverage generation
- c.after(:suite) do
- RSpec::Puppet::Coverage.report!
- end
-end