diff options
Diffstat (limited to 'spec/unit/parser/functions/digest_spec.rb')
-rwxr-xr-x | spec/unit/parser/functions/digest_spec.rb | 31 |
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 |