Skip to content

Commit c67449c

Browse files
author
Bogdan Irimie
authored
(maint) Mock Hocon.load(...) as it is used by Facter 4 before it is used in the class under test. (#263)
1 parent f4bc4c1 commit c67449c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spec/puppet/resource_api/transport/wrapper_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
it 'will not throw an error' do
1212
allow(File).to receive(:exist?).and_return(true)
13+
allow(Hocon).to receive(:load).and_call_original
1314
expect(Puppet::ResourceApi::Transport).to receive(:connect)
1415
expect(Hocon).to receive(:load).with('/etc/credentials', any_args).and_return('foo' => %w[a b], 'bar' => 2)
1516
expect { described_class.new('wibble', url) }.not_to raise_error
@@ -27,7 +28,8 @@
2728
let(:config) { {} }
2829

2930
it 'will use the configuration directly' do
30-
expect(Hocon).not_to receive(:load)
31+
allow(Hocon).to receive(:load).and_call_original
32+
expect(Hocon).not_to receive(:load).with('/etc/credentials', any_args)
3133
expect(Puppet::ResourceApi::Transport).to receive(:connect)
3234
described_class.new('wibble', config)
3335
end

0 commit comments

Comments
 (0)