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 30, 2018
1 parent c2e5d8c commit 9f7b6db
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 @@ -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_instance).and_return(connection)
Expand Down

0 comments on commit 9f7b6db

Please sign in to comment.