From 92b2bbf950e27e9cd49416d19fdffe72fc8ffd2f Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Mon, 2 Oct 2023 15:11:25 +0100 Subject: [PATCH] (maint) - Update tests --- lib/rspec-puppet/spec_helper.rb | 1 - spec/classes/server_facts_spec.rb | 1 - spec/unit/adapters_spec.rb | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/rspec-puppet/spec_helper.rb b/lib/rspec-puppet/spec_helper.rb index 6dfff00b9..8c24e2650 100644 --- a/lib/rspec-puppet/spec_helper.rb +++ b/lib/rspec-puppet/spec_helper.rb @@ -4,7 +4,6 @@ RSpec.configure do |c| c.module_path = File.join(fixture_path, 'modules') - c.manifest_dir = File.join(fixture_path, 'manifests') c.manifest = File.join(fixture_path, 'manifests', 'site.pp') c.environmentpath = File.join(Dir.pwd, 'spec') end diff --git a/spec/classes/server_facts_spec.rb b/spec/classes/server_facts_spec.rb index a41f3d697..139f6cf2b 100644 --- a/spec/classes/server_facts_spec.rb +++ b/spec/classes/server_facts_spec.rb @@ -16,5 +16,4 @@ it { is_expected.to contain_notify('serverip-192.168.1.10') } it { is_expected.to contain_notify("serverversion-#{Puppet.version}") } it { is_expected.to contain_notify('environment-rp_env') } - end end diff --git a/spec/unit/adapters_spec.rb b/spec/unit/adapters_spec.rb index 189ea62dc..7ce55445a 100644 --- a/spec/unit/adapters_spec.rb +++ b/spec/unit/adapters_spec.rb @@ -31,6 +31,25 @@ def context_double(options = {}) end end + it 'sets Puppet[:strict_variables] to false by default' do + subject.setup_puppet(context_double) + # strict variables enabled by default in puppet 8.x + + setting = Puppet::Util::Package.versioncmp(Puppet.version, '8.0.0') >= 0 + expect(Puppet[:strict_variables]).to be(setting) + end + + it 'reads the :strict_variables setting' do + context = context_double strict_variables: true + subject.setup_puppet(context) + expect(Puppet[:strict_variables]).to be(true) + end + + it 'overrides the environmentpath set by Puppet::Test::TestHelper' do + context = context_double environmentpath: '/path/to/my/environments' + subject.setup_puppet(context) + expect(Puppet[:environmentpath]).to match(%r{(C:)?/path/to/my/environments}) + end + describe '#set_setting' do describe 'with a context specific setting' do it 'sets the Puppet setting based on the example group setting' do