diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2010-01-27 20:29:47 +0100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2010-01-28 12:02:15 +1100 |
commit | 46f9d00714d8fa6c2dc88d1e4f19ed6786943220 (patch) | |
tree | 8a234ab1f7fd34aa7a7ef08a1d5e7a2eba08aaf5 /spec/unit/ssl | |
parent | 04842efb37d31f697f726d8bd9ae38788aa3dc5c (diff) | |
download | puppet-46f9d00714d8fa6c2dc88d1e4f19ed6786943220.tar.gz puppet-46f9d00714d8fa6c2dc88d1e4f19ed6786943220.tar.xz puppet-46f9d00714d8fa6c2dc88d1e4f19ed6786943220.zip |
Fix #3117 - cert fingerprinting uses a method not available in ruby <= 1.8.6
OpenSSL::Digest.hexdigest is not available on older ruby versions.
This patch accesses directly to the digest instead (which hopefully
support hexdigest).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/ssl')
-rwxr-xr-x | spec/unit/ssl/base.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/unit/ssl/base.rb b/spec/unit/ssl/base.rb index dfab3c843..062ea3315 100755 --- a/spec/unit/ssl/base.rb +++ b/spec/unit/ssl/base.rb @@ -16,11 +16,13 @@ describe Puppet::SSL::Certificate do @cert = stub 'cert', :to_der => "DER" @base.stubs(:content).returns(@cert) OpenSSL::Digest.stubs(:constants).returns ["MD5", "DIGEST"] + @digest = stub_everything + OpenSSL::Digest.stubs(:const_get).returns @digest end it "should digest the certificate DER value and return a ':' seperated nibblet string" do @cert.expects(:to_der).returns("DER") - OpenSSL::Digest.expects(:hexdigest).with("MD5", "DER").returns "digest" + @digest.expects(:hexdigest).with("DER").returns "digest" @base.fingerprint.should == "DI:GE:ST" end @@ -32,7 +34,8 @@ describe Puppet::SSL::Certificate do end it "should use the given digest algorithm" do - OpenSSL::Digest.expects(:hexdigest).with("DIGEST", "DER").returns "digest" + OpenSSL::Digest.stubs(:const_get).with("DIGEST").returns @digest + @digest.expects(:hexdigest).with("DER").returns "digest" @base.fingerprint(:digest).should == "DI:GE:ST" end |