diff --git a/spec/functions/fqdn_rand_string_spec.rb b/spec/functions/fqdn_rand_string_spec.rb index 1102b87f8..9eed4ad04 100644 --- a/spec/functions/fqdn_rand_string_spec.rb +++ b/spec/functions/fqdn_rand_string_spec.rb @@ -57,7 +57,11 @@ def fqdn_rand_string(max, args = {}) # workaround not being able to use let(:facts) because some tests need # multiple different hostnames in one context - allow(scope).to receive(:lookupvar).with('::fqdn', {}).and_return(host) + if Gem::Version.new(Puppet::PUPPETVERSION) < Gem::Version.new('7.23.0') + allow(scope).to receive(:lookupvar).with('::fqdn', {}).and_return(host) + else + allow(scope).to receive(:lookupvar).with('facts', {}).and_return({ 'networking' => { 'fqdn' => host } }) + end function_args = [max] if args.key?(:charset) || !extra.empty?