summaryrefslogtreecommitdiffstats
path: root/spec/unit/ssl/certificate.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/ssl/certificate.rb')
-rwxr-xr-xspec/unit/ssl/certificate.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/unit/ssl/certificate.rb b/spec/unit/ssl/certificate.rb
index eb2464a48..34868dcd2 100755
--- a/spec/unit/ssl/certificate.rb
+++ b/spec/unit/ssl/certificate.rb
@@ -26,7 +26,21 @@ describe Puppet::SSL::Certificate do
end
it "should only support the text format" do
- @class.supported_formats.should == [:str]
+ @class.supported_formats.should == [:s]
+ end
+
+ describe "when converting from a string" do
+ it "should create a certificate instance with its name set to the certificate subject and its content set to the extracted certificate" do
+ cert = stub 'certificate', :subject => "/CN=Foo.madstop.com"
+ OpenSSL::X509::Certificate.expects(:new).with("my certificate").returns(cert)
+
+ mycert = stub 'sslcert'
+ mycert.expects(:content=).with(cert)
+
+ @class.expects(:new).with("foo.madstop.com").returns mycert
+
+ @class.from_s("my certificate")
+ end
end
describe "when managing instances" do