From 9e0d8a8e0a83e1659fdb289078fd15862dca028b Mon Sep 17 00:00:00 2001 From: sgzijl Date: Mon, 9 Sep 2013 16:20:36 +0200 Subject: (#22214): close content file before executing checkscript Right now validation seems to be done against zero byte generated temp files. We need to close the file before executing validation against it. --- spec/unit/puppet/parser/functions/validate_cmd_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/unit') diff --git a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb b/spec/unit/puppet/parser/functions/validate_cmd_spec.rb index 69ea7f4..c0defbc 100644 --- a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb +++ b/spec/unit/puppet/parser/functions/validate_cmd_spec.rb @@ -78,4 +78,12 @@ describe Puppet::Parser::Functions.function(:validate_cmd) do end end end + + it "can positively validate file content" do + expect { subject.call ["non-empty", "/usr/bin/test -s"] }.to_not raise_error + end + + it "can negatively validate file content" do + expect { subject.call ["", "/usr/bin/test -s"] }.to raise_error Puppet::ParseError, /failed to validate.*test -s/ + end end -- cgit v1.2.3