summaryrefslogtreecommitdiff
path: root/spec/unit/parser/functions/digest_spec.rb
diff options
context:
space:
mode:
authorStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
committerStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
commitd4b83be375ac1dead058e091191ee7c7b7c24c8a (patch)
treedc825687392ae3068de5b764be60c53122d9e02a /spec/unit/parser/functions/digest_spec.rb
parent229cbb976fe0f70f5f30548b83517b415840f9bb (diff)
parent1681684857c6e39d60d87b0b3520d8783977ceff (diff)
downloadpuppet-upstream/3.7.0.tar.gz
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/parser/functions/digest_spec.rb')
-rwxr-xr-xspec/unit/parser/functions/digest_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/parser/functions/digest_spec.rb b/spec/unit/parser/functions/digest_spec.rb
new file mode 100755
index 000000000..e3c0762d4
--- /dev/null
+++ b/spec/unit/parser/functions/digest_spec.rb
@@ -0,0 +1,31 @@
+#!/usr/bin/env rspec
+require 'spec_helper'
+
+describe "the digest function", :uses_checksums => true do
+ before :all do
+ Puppet::Parser::Functions.autoloader.loadall
+ end
+
+ before :each do
+ n = Puppet::Node.new('unnamed')
+ c = Puppet::Parser::Compiler.new(n)
+ @scope = Puppet::Parser::Scope.new(c)
+ end
+
+ it "should exist" do
+ Puppet::Parser::Functions.function("digest").should == "function_digest"
+ end
+
+ with_digest_algorithms do
+ it "should use the proper digest function" do
+ result = @scope.function_digest([plaintext])
+ result.should(eql( checksum ))
+ end
+
+ it "should only accept one parameter" do
+ expect do
+ @scope.function_digest(['foo', 'bar'])
+ end.to raise_error(ArgumentError)
+ end
+ end
+end