Skip to content

Commit

Permalink
(FM-7691) fix connection_info/schema misnomer in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS committed Jan 24, 2019
1 parent c7f3203 commit c46f50b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions spec/puppet/resource_api/transport_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

context 'when connecting to a transport' do
let(:name) { 'test_target' }
let(:connection_info) do
let(:schema) do
{
name: 'test_target',
desc: 'a basic transport',
Expand All @@ -103,18 +103,18 @@

context 'when the transport file does not exist' do
it 'throws a LoadError' do
expect(described_class).to receive(:validate).with(name, connection_info)
expect { described_class.connect(name, connection_info) }.to raise_error LoadError, %r{(no such file to load|cannot load such file) -- puppet/transport/test_target}
expect(described_class).to receive(:validate).with(name, host: 'example.com')
expect { described_class.connect(name, host: 'example.com') }.to raise_error LoadError, %r{(no such file to load|cannot load such file) -- puppet/transport/test_target}
end
end

context 'when the transport file does exist' do
context 'with an incorrectly defined transport' do
it 'throws a NameError' do
expect(described_class).to receive(:validate).with(name, connection_info)
expect(described_class).to receive(:validate).with(name, host: 'example.com')
expect(described_class).to receive(:require).with('puppet/transport/test_target')
expect { described_class.connect(name, connection_info) }.to raise_error NameError,
%r{uninitialized constant (Puppet::Transport|TestTarget)}
expect { described_class.connect(name, host: 'example.com') }.to raise_error NameError,
%r{uninitialized constant (Puppet::Transport|TestTarget)}
end
end

Expand All @@ -123,12 +123,12 @@

it 'loads initiates the class successfully' do
expect(described_class).to receive(:require).with('puppet/transport/test_target')
expect(described_class).to receive(:validate).with(name, connection_info)
expect(described_class).to receive(:validate).with(name, host: 'example.com')

stub_const('Puppet::Transport::TestTarget', test_target)
expect(test_target).to receive(:new).with(connection_info)
expect(test_target).to receive(:new).with(host: 'example.com')

described_class.connect(name, connection_info)
described_class.connect(name, host: 'example.com')
end
end
end
Expand Down

0 comments on commit c46f50b

Please sign in to comment.