When we query for all faces we need to scan the entire Ruby load path, look
for everything that looks like a face, and load it up.  That is a fairly
expensive operation, especially on a platform that has slow I/O.

*cough* EC2 *cough*

Because of that we only scan once, and assume that the list is static
thereafter; this works OK out in the field, but sucks in testing where that
global state gets in the way of the rest of our fiddling under the hood.

This resets the '@loaded' member of the collection additionally, which is what
should be done since we have reset the rest of the collection at the same
time.

We don't bother to reset it, as an extra scan during tests is not a problem.

Reviewed-By: Nick Lewis <[email protected]>
---
 spec/unit/interface/face_collection_spec.rb |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/spec/unit/interface/face_collection_spec.rb 
b/spec/unit/interface/face_collection_spec.rb
index 890e06a..4358ef4 100755
--- a/spec/unit/interface/face_collection_spec.rb
+++ b/spec/unit/interface/face_collection_spec.rb
@@ -16,11 +16,12 @@ describe Puppet::Interface::FaceCollection do
     @original_faces    = subject.instance_variable_get("@faces").dup
     @original_required = $".dup
     $".delete_if do |path| path =~ %r{/face/.*\.rb$} end
-    subject.instance_variable_get("@faces").clear
+    subject.instance_variable_get(:@faces).clear
+    subject.instance_variable_set(:@loaded, false)
   end
 
   after :each do
-    subject.instance_variable_set("@faces", @original_faces)
+    subject.instance_variable_set(:@faces, @original_faces)
     $".clear ; @original_required.each do |item| $" << item end
   end
 
-- 
1.7.5

-- 
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.

Reply via email to