summaryrefslogtreecommitdiffstats
path: root/spec/unit/util
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-05 17:49:36 -0600
committerLuke Kanies <luke@madstop.com>2008-11-05 17:49:36 -0600
commitf4800e8aeb6196aebc43d36f69b2e2a182d1bf5c (patch)
tree5710c5a59bb6956ca04db6e9cbef3186c8352bcf /spec/unit/util
parent44fadd1847e477b713ab2d0de5633ae446a3642e (diff)
downloadpuppet-f4800e8aeb6196aebc43d36f69b2e2a182d1bf5c.tar.gz
puppet-f4800e8aeb6196aebc43d36f69b2e2a182d1bf5c.tar.xz
puppet-f4800e8aeb6196aebc43d36f69b2e2a182d1bf5c.zip
Adding a method to Checksums to extract the sum type
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/util')
-rwxr-xr-xspec/unit/util/checksums.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/util/checksums.rb b/spec/unit/util/checksums.rb
index 0e0d06c0d..85126a8ce 100755
--- a/spec/unit/util/checksums.rb
+++ b/spec/unit/util/checksums.rb
@@ -28,6 +28,14 @@ describe Puppet::Util::Checksums do
end
end
+ it "should have a method for stripping a sum type from an existing checksum" do
+ @summer.sumtype("{md5}asdfasdfa").should == "md5"
+ end
+
+ it "should return a nil sumtype if the checksum does not mention a checksum type" do
+ @summer.sumtype("asdfasdfa").should be_nil
+ end
+
{:md5 => Digest::MD5, :sha1 => Digest::SHA1}.each do |sum, klass|
describe("when using %s" % sum) do
it "should use #{klass} to calculate string checksums" do