Skip to content

Commit 827006e

Browse files
committed
(FM-7691) Fix tests to not rely on previously registered transports
1 parent d7a01db commit 827006e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spec/puppet/resource_api/transport_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
Puppet.debug = true
1212
end
1313

14+
after(:each) do
15+
# reset registered transports between tests to reduce cross-test poisoning
16+
described_class.instance_variable_set(:@transports, nil)
17+
end
18+
1419
context 'when registering a schema with missing keys' do
1520
it { expect { described_class.register([]) }.to raise_error(Puppet::DevError, %r{requires a hash as schema}) }
1621
it { expect { described_class.register({}) }.to raise_error(Puppet::DevError, %r{requires a `:name`}) }
@@ -25,7 +30,10 @@
2530
it { expect { described_class.register(schema) }.not_to raise_error }
2631

2732
context 'when re-registering a transport' do
28-
it { expect { described_class.register(schema) }.to raise_error(Puppet::DevError, %r{`minimal` is already registered}) }
33+
it {
34+
described_class.register(schema)
35+
expect { described_class.register(schema) }.to raise_error(Puppet::DevError, %r{`minimal` is already registered})
36+
}
2937
end
3038
end
3139

0 commit comments

Comments
 (0)