diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-20 16:26:02 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-20 16:30:36 -0700 |
| commit | 677752d44e180d7293fbae6594f51fe7d41fb3fc (patch) | |
| tree | 7772d47166a69b8b2057c52f068d9a64524f2bae /spec/unit | |
| parent | 7b3744cd363c817c515f865ccdf45bdfbdb5796b (diff) | |
| download | puppet-677752d44e180d7293fbae6594f51fe7d41fb3fc.tar.gz puppet-677752d44e180d7293fbae6594f51fe7d41fb3fc.tar.xz puppet-677752d44e180d7293fbae6594f51fe7d41fb3fc.zip | |
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.
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/interface_spec.rb | 11 |
1 files changed, 6 insertions, 5 deletions
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 |
