Skip to content

Commit

Permalink
Test the ability to disable raising exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Magisus committed Nov 29, 2018
1 parent 6289aff commit 6197236
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/functions/lookup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@
}.to raise_error(Puppet::Error, %r{Unable to parse a hostname})
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(Puppet::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).and_return(connection)
Expand Down

0 comments on commit 6197236

Please sign in to comment.