From 71c411cc029b4eb098f84b06c6e120750d5a4711 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 13 Nov 2023 19:58:47 +0100 Subject: [PATCH] Add additional test for foreman::foreman() This is to make sure using Puppet::ParseError is still valid to raise. --- spec/functions/foreman_foreman_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/functions/foreman_foreman_spec.rb b/spec/functions/foreman_foreman_spec.rb index 24dad6863..9e12d32f1 100644 --- a/spec/functions/foreman_foreman_spec.rb +++ b/spec/functions/foreman_foreman_spec.rb @@ -10,6 +10,10 @@ is_expected.to run.with_params().and_raise_error(ArgumentError) end + it 'should throw an error with filter_result=true' do + is_expected.to run.with_params('hosts', 'hostgroup=Grid', '20', 'https://foreman.example.com', 'my_api_foreman_user', 'my_api_foreman_pass', 10, true).and_raise_error(Puppet::ParseError, /Foreman: Invalid filter_result/) + end + it 'should succeed with no timeout specified' do stub_request(:get, "https://foreman.example.com/api/hosts?per_page=20&search=hostgroup=Grid"). with(basic_auth: ['my_api_foreman_user', 'my_api_foreman_pass']).