diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-10 16:47:33 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-12 16:12:07 -0700 |
| commit | 6fcf03c52f98c6e4bcce85548d783a832eaa387b (patch) | |
| tree | fdfdcdaf06d4674a5d221d8f110a3489b88612b9 | |
| parent | 20d9ac1a5b71cd52c3edea107c1cef08562641fd (diff) | |
| download | puppet-6fcf03c52f98c6e4bcce85548d783a832eaa387b.tar.gz puppet-6fcf03c52f98c6e4bcce85548d783a832eaa387b.tar.xz puppet-6fcf03c52f98c6e4bcce85548d783a832eaa387b.zip | |
maint: added testing for Puppet::Faces#[]
We didn't do much testing here, which was vaguely reasonable when we didn't
distinguish it from the #define method. Now they are split out we need to be
more careful about testing the right things.
Reviewed-By: Matt Robinson <matt@puppetlabs.com>
| -rwxr-xr-x | spec/unit/interface_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb index ea11b21ba..b25d06f51 100755 --- a/spec/unit/interface_spec.rb +++ b/spec/unit/interface_spec.rb @@ -1,3 +1,4 @@ +require 'spec_helper' require 'puppet/faces' require 'puppet/interface' @@ -16,6 +17,20 @@ describe Puppet::Interface do Puppet::Interface::FaceCollection.instance_variable_set("@faces", @faces) end + describe "#[]" do + it "should fail when no version is requested" do + expect { subject[:huzzah] }.should raise_error ArgumentError + end + + it "should raise an exception when the requested version is unavailable" do + expect { subject[:huzzah, '17.0.0'] }.should raise_error, Puppet::Error + end + + it "should raise an exception when the requested face doesn't exist" do + expect { subject[:burrble_toot, :current] }.should raise_error, Puppet::Error + end + end + describe "#define" do it "should register the face" do face = subject.define(:face_test_register, '0.0.1') |
