From 7b9e571657b00d724a91ca6f44fc348b96b439b4 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 11 Feb 2020 14:32:20 +0100 Subject: [PATCH 1/2] Require bundler for gem versions --- lib/voxpupuli/test/spec_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/voxpupuli/test/spec_helper.rb b/lib/voxpupuli/test/spec_helper.rb index 0c8b493..6168a5b 100644 --- a/lib/voxpupuli/test/spec_helper.rb +++ b/lib/voxpupuli/test/spec_helper.rb @@ -8,6 +8,7 @@ # The environment variable `PUPPET_VERSION` is available in our travis environment, but we cannot rely on it # if somebody runs the tests locally. For that case we should fallback the the puppet gem version. def suggest_facter_version + require 'bundler' puppet_version = ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : Gem.loaded_specs['puppet'].version.to_s Gem::Dependency.new('', puppet_version).match?('', '5') ? '3.11.0' : '3.14.0' end From 2a6b7131d0df64e83e3639c325611e6c10a4fdaa Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 6 Feb 2020 12:05:34 +0100 Subject: [PATCH 2/2] Move ENV override into suggest_facter_version --- lib/voxpupuli/test/spec_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/voxpupuli/test/spec_helper.rb b/lib/voxpupuli/test/spec_helper.rb index 6168a5b..7f15ed7 100644 --- a/lib/voxpupuli/test/spec_helper.rb +++ b/lib/voxpupuli/test/spec_helper.rb @@ -8,6 +8,8 @@ # The environment variable `PUPPET_VERSION` is available in our travis environment, but we cannot rely on it # if somebody runs the tests locally. For that case we should fallback the the puppet gem version. def suggest_facter_version + return ENV['FACTERDB_FACTS_VERSION'] if ENV['FACTERDB_FACTS_VERSION'] + require 'bundler' puppet_version = ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : Gem.loaded_specs['puppet'].version.to_s Gem::Dependency.new('', puppet_version).match?('', '5') ? '3.11.0' : '3.14.0' @@ -27,7 +29,7 @@ def suggest_facter_version include RspecPuppetFacts RSpec.configure do |config| - config.default_facter_version = ENV['FACTERDB_FACTS_VERSION'] || suggest_facter_version + config.default_facter_version = suggest_facter_version # Coverage generation config.after(:suite) do