diff --git a/lib/puppet/functions/validate_domain_name.rb b/lib/puppet/functions/validate_domain_name.rb index c2833043f..b2364a83c 100644 --- a/lib/puppet/functions/validate_domain_name.rb +++ b/lib/puppet/functions/validate_domain_name.rb @@ -24,5 +24,11 @@ repeated_param 'Variant[Stdlib::Fqdn, Stdlib::Dns::Zone]', :values end - def validate_domain_name(*_values); end + def validate_domain_name(*args) + assert_arg_count(args) + end + + def assert_arg_count(args) + raise(ArgumentError, 'validate_domain_name(): Wrong number of arguments need at least one') if args.empty? + end end diff --git a/spec/functions/validate_domain_name_spec.rb b/spec/functions/validate_domain_name_spec.rb index 78aea8218..3132c64d7 100644 --- a/spec/functions/validate_domain_name_spec.rb +++ b/spec/functions/validate_domain_name_spec.rb @@ -5,6 +5,7 @@ describe 'validate_domain_name' do describe 'signature validation' do it { is_expected.not_to eq(nil) } + it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{wrong number of arguments}i) } end describe 'valid inputs' do