summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-07-25 12:05:31 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-07-25 12:05:31 -0700
commit10e05ad302d1b2d93f5da070d612817729473009 (patch)
tree208b9d6a369437eda49afe6d2ed08b540e20b0b2 /spec/unit
parent29a25abe7a6e04d2b2f78b604aca3d819f010d38 (diff)
downloadpuppet-10e05ad302d1b2d93f5da070d612817729473009.tar.gz
puppet-10e05ad302d1b2d93f5da070d612817729473009.tar.xz
puppet-10e05ad302d1b2d93f5da070d612817729473009.zip
(#7266) Move Certificate option validation into face.
The validation for the ca_location option on the certificate application continued to hang around on the application long after the face realized its potential to take responsibility for itself. This change moves (and adds) validation code as appropriate into the Face. Reviewed-By: Matt Robinson
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/face/certificate_spec.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/unit/face/certificate_spec.rb b/spec/unit/face/certificate_spec.rb
index 0cb905b75..9291d7523 100755
--- a/spec/unit/face/certificate_spec.rb
+++ b/spec/unit/face/certificate_spec.rb
@@ -10,14 +10,26 @@ describe Puppet::Face[:certificate, '0.0.1'] do
end
it "should set the ca location when invoked" do
- Puppet::SSL::Host.expects(:ca_location=).with(:foo)
+ Puppet::SSL::Host.expects(:ca_location=).with(:local)
Puppet::SSL::Host.indirection.expects(:save)
- subject.sign "hello, friend", :ca_location => :foo
+ subject.sign "hello, friend", :ca_location => :local
end
it "(#7059) should set the ca location when an inherited action is invoked" do
- Puppet::SSL::Host.expects(:ca_location=).with(:foo)
+ Puppet::SSL::Host.expects(:ca_location=).with(:local)
subject.indirection.expects(:find)
- subject.find "hello, friend", :ca_location => :foo
+ subject.find "hello, friend", :ca_location => :local
+ end
+
+ it "should validate the option as required" do
+ expect do
+ subject.find 'hello, friend'
+ end.to raise_exception ArgumentError, /required/i
+ end
+
+ it "should validate the option as a supported value" do
+ expect do
+ subject.find 'hello, friend', :ca_location => :foo
+ end.to raise_exception ArgumentError, /valid values/i
end
end