diff --git a/spec/functions/lookup_spec.rb b/spec/functions/lookup_spec.rb index ca21e43..19e55f6 100644 --- a/spec/functions/lookup_spec.rb +++ b/spec/functions/lookup_spec.rb @@ -64,6 +64,13 @@ }.to raise_error(Puppet::Error, %r{No vault_url given and VAULT_ADDR env variable not set}) end + it 'returns nil instead of raising when raising is disabled' do + expect { + result = function.execute('/v1/whatever', 'vault.docker', false) + expect(result).to be(nil) + }.not_to raise_error + end + it 'raises a Puppet error when auth fails' do connection = instance_double('Puppet::Network::HTTP::Connection', address: 'vault.doesnotexist') expect(Puppet::Network::HttpPool).to receive(:http_ssl_instance).with('vault.doesnotexist', 8200).and_return(connection)