Skip to content

Commit

Permalink
(FM-7691) Fix tests to not rely on previously registered transports
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS committed Jan 23, 2019
1 parent 383028a commit 7d51510
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/puppet/resource_api/transport_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
Puppet.debug = true
end

after(:each) do
# reset registered transports between tests to reduce cross-test poisoning
described_class.instance_variable_set(:@transports, nil)
end

context 'when registering a schema with missing keys' do
it { expect { described_class.register([]) }.to raise_error(Puppet::DevError, %r{requires a hash as schema}) }
it { expect { described_class.register({}) }.to raise_error(Puppet::DevError, %r{requires a `:name`}) }
Expand All @@ -25,7 +30,10 @@
it { expect { described_class.register(schema) }.not_to raise_error }

context 'when re-registering a transport' do
it { expect { described_class.register(schema) }.to raise_error(Puppet::DevError, %r{`minimal` is already registered}) }
it {
described_class.register(schema)
expect { described_class.register(schema) }.to raise_error(Puppet::DevError, %r{`minimal` is already registered})
}
end
end

Expand Down

0 comments on commit 7d51510

Please sign in to comment.