From 09fcf8e0447f0febab2febb2b14ff4243d120a72 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 28 Apr 2023 00:07:51 +0100 Subject: [PATCH] Test rspec-puppet branch --- Gemfile | 3 ++- manifests/init.pp | 4 ++++ spec/classes/example_spec.rb | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 15313c3..487c33c 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,11 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', :git => 'https://github.com/voxpupuli/voxpupuli-test.git', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 2.0', :require => false + gem 'rspec-puppet', :git => 'https://github.com/alexjfisher/rspec-puppet.git', :branch => 'include_legacy_facts' end group :development do diff --git a/manifests/init.pp b/manifests/init.pp index fbf7850..e7b6f51 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -14,4 +14,8 @@ mode => '0644', content => $content, } + + notify { 'legacy_facts_check': + message => $facts['fqdn'], + } } diff --git a/spec/classes/example_spec.rb b/spec/classes/example_spec.rb index e19972e..945f13e 100644 --- a/spec/classes/example_spec.rb +++ b/spec/classes/example_spec.rb @@ -9,6 +9,14 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_file('/tmp/puppet-example').with_content('Hello World!') } + + describe 'testing legacy facts pruning' do + if os_facts[:puppetversion].start_with?('8') + it { is_expected.to contain_notify('legacy_facts_check').without_message } + else + it { is_expected.to contain_notify('legacy_facts_check').with_message('foo.example.com') } + end + end end end end