We were leaking some mocks in the network device singleton from tests to tests.
Signed-off-by: Brice Figureau <[email protected]> --- lib/puppet/util/network_device.rb | 5 +++++ spec/unit/util/network_device_spec.rb | 4 ++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/lib/puppet/util/network_device.rb b/lib/puppet/util/network_device.rb index d9c1aa3..a650670 100644 --- a/lib/puppet/util/network_device.rb +++ b/lib/puppet/util/network_device.rb @@ -9,4 +9,9 @@ class Puppet::Util::NetworkDevice rescue => detail raise "Can't load #{device.provider} for #{device.name}: #{detail}" end + + # for tests reset + def self.clear + @current = nil + end end \ No newline at end of file diff --git a/spec/unit/util/network_device_spec.rb b/spec/unit/util/network_device_spec.rb index 70cb509..347986a 100644 --- a/spec/unit/util/network_device_spec.rb +++ b/spec/unit/util/network_device_spec.rb @@ -10,6 +10,10 @@ describe Puppet::Util::NetworkDevice do @device = OpenStruct.new(:name => "name", :provider => "test") end + after(:each) do + Puppet::Util::NetworkDevice.clear + end + class Puppet::Util::NetworkDevice::Test class Device def initialize(device) -- 1.7.5.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
