Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions spec/puppet/resource_api/transport_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def change_environment(name = nil)
describe '#inject_device(name, transport)' do
let(:device_name) { 'wibble' }
let(:transport) { instance_double(Puppet::Transport::Wibble, 'transport') }
let(:wrapper) { instance_double(Puppet::ResourceApi::Transport::Wrapper, 'wrapper') }
let(:wrapper) { instance_double(described_class::Wrapper, 'wrapper') }

before do
module Puppet::Transport
Expand All @@ -251,8 +251,8 @@ class Wibble; end

context 'when puppet has set_device' do
it 'wraps the transport and calls set_device within NetworkDevice' do
allow(Puppet::ResourceApi::Transport::Wrapper).to receive(:new).with(device_name, transport).and_return(wrapper)
expect(Puppet::ResourceApi::Transport::Wrapper).to receive(:new).with(device_name, transport)
allow(described_class::Wrapper).to receive(:new).with(device_name, transport).and_return(wrapper)
expect(described_class::Wrapper).to receive(:new).with(device_name, transport)
allow(Puppet::Util::NetworkDevice).to receive(:respond_to?).with(:set_device).and_return(true)
expect(Puppet::Util::NetworkDevice).to receive(:set_device).with(device_name, wrapper)

Expand All @@ -262,8 +262,8 @@ class Wibble; end

context 'when puppet does not have set_device' do
it 'wraps the transport and sets it as current in NetworkDevice' do
allow(Puppet::ResourceApi::Transport::Wrapper).to receive(:new).with(device_name, transport).and_return(wrapper)
expect(Puppet::ResourceApi::Transport::Wrapper).to receive(:new).with(device_name, transport)
allow(described_class::Wrapper).to receive(:new).with(device_name, transport).and_return(wrapper)
expect(described_class::Wrapper).to receive(:new).with(device_name, transport)
allow(Puppet::Util::NetworkDevice).to receive(:respond_to?).with(:set_device).and_return(false)
expect(Puppet::Util::NetworkDevice).to receive(:respond_to?).with(:set_device)

Expand Down
12 changes: 6 additions & 6 deletions spec/puppet/resource_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

it 'has a version number' do
expect(Puppet::ResourceApi::VERSION).not_to be nil
expect(described_class::VERSION).not_to be nil
end

context 'when registering a minimal type' do
Expand Down Expand Up @@ -1482,7 +1482,7 @@ class OtherDevice; end

before do
allow(Puppet::Util::NetworkDevice).to receive(:current).with(no_args).and_return(transport)
allow(transport).to receive(:is_a?).with(Puppet::ResourceApi::Transport::Wrapper).and_return(true)
allow(transport).to receive(:is_a?).with(described_class::Transport::Wrapper).and_return(true)
allow(transport).to receive(:schema).and_return(schema_def)
allow(schema_def).to receive(:name).and_return(schema_name)

Expand Down Expand Up @@ -1654,7 +1654,7 @@ def set(_context, changes)
type.rsapi_provider_get_cache.clear

allow(type.my_provider).to receive(:get)
.with(kind_of(Puppet::ResourceApi::BaseContext))
.with(kind_of(described_class::BaseContext))
.and_return([{ name: 'somename', test_string: 'canonfoo' },
{ name: 'other', test_string: 'canonbar' }])
end
Expand Down Expand Up @@ -1839,7 +1839,7 @@ def set(_context, changes)

before do
allow(type.my_provider).to receive(:get)
.with(kind_of(Puppet::ResourceApi::BaseContext))
.with(kind_of(described_class::BaseContext))
.and_return([{ name: 'somename', test_string: 'foo' },
{ name: 'other', test_string: 'bar' }])
type.rsapi_provider_get_cache.clear
Expand Down Expand Up @@ -2113,7 +2113,7 @@ class Wibble; end
context 'when a transport is returned by NetworkDevice.current' do
it 'stores the provider with the the name of the transport' do
allow(Puppet::Util::NetworkDevice).to receive(:current).and_return(wrapper)
allow(wrapper).to receive(:is_a?).with(Puppet::ResourceApi::Transport::Wrapper).and_return(true)
allow(wrapper).to receive(:is_a?).with(described_class::Transport::Wrapper).and_return(true)
allow(wrapper).to receive(:transport).and_return(transport)
allow(transport).to receive(:class).and_return(Puppet::Transport::Wibble)

Expand Down Expand Up @@ -2361,7 +2361,7 @@ def set(_context, changes) end
end

it 'calls Puppet::ResourceApi::Transport.register' do
expect(Puppet::ResourceApi::Transport).to receive(:register).with(schema)
expect(described_class::Transport).to receive(:register).with(schema)
described_class.register_transport(schema)
end
end
Expand Down