summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-05-02 13:57:57 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-05-02 15:34:03 -0700
commitc63e9c2394a30fe653908cd15967218d90fa34d6 (patch)
treed0b75f87547e5e5d778f2805304caa3ead30bb13
parenta71bfa10123276b1dc96c5ef540b9fbf222c2f6d (diff)
downloadpuppet-c63e9c2394a30fe653908cd15967218d90fa34d6.tar.gz
puppet-c63e9c2394a30fe653908cd15967218d90fa34d6.tar.xz
puppet-c63e9c2394a30fe653908cd15967218d90fa34d6.zip
maint: reset more global state in testing faces...
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 <nick@puppetlabs.com>
-rwxr-xr-xspec/unit/interface/face_collection_spec.rb5
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 890e06a9e..4358ef4b6 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