From 677752d44e180d7293fbae6594f51fe7d41fb3fc Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Wed, 20 Apr 2011 16:26:02 -0700 Subject: maint: handle face clear/reset sanely in the interface spec. We used to flush the loaded face cache, but not the list of 'require' things, which meant that these tests couldn't work with anything outside their own setup, which is actually pretty undesirable. Instead, port the code from the face_collection spec that handles this in a way that makes me less inclined to weep, and which lets the surrounding code work as designed. --- spec/unit/interface_spec.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'spec/unit') diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb index b4fef0307..5eb7922a2 100755 --- a/spec/unit/interface_spec.rb +++ b/spec/unit/interface_spec.rb @@ -5,16 +5,17 @@ require 'puppet/interface' describe Puppet::Interface do subject { Puppet::Interface } - before :all do - @faces = Puppet::Interface::FaceCollection.instance_variable_get("@faces").dup - end - before :each do + @faces = Puppet::Interface::FaceCollection. + instance_variable_get("@faces").dup + @dq = $".dup + $".delete_if do |path| path =~ %r{/face/.*\.rb$} end Puppet::Interface::FaceCollection.instance_variable_get("@faces").clear end - after :all do + after :each do Puppet::Interface::FaceCollection.instance_variable_set("@faces", @faces) + $".clear ; @dq.each do |item| $" << item end end describe "#[]" do -- cgit