File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
spec/unit/puppet/parser/functions Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11require 'spec_helper'
22
3+ TESTEXE = File . exists? ( '/usr/bin/test' ) ? '/usr/bin/test' : '/bin/test'
4+ TOUCHEXE = File . exists? ( '/usr/bin/touch' ) ? '/usr/bin/touch' : '/bin/touch'
5+
36describe Puppet ::Parser ::Functions . function ( :validate_cmd ) do
47 let ( :scope ) { PuppetlabsSpec ::PuppetInternals . scope }
58
1922 describe "on validation failure" do
2023 it "includes the command error output" do
2124 expect {
22- subject . call [ '' , '/bin/touch /cant/touch/this' ]
23- } . to raise_error Puppet ::ParseError , /cannot touch/
25+ subject . call [ '' , " #{ TOUCHEXE } /cant/touch/this" ]
26+ } . to raise_error Puppet ::ParseError , /( cannot touch|o such file or) /
2427 end
2528
2629 it "includes the command return value" do
3235
3336 describe "when performing actual validation" do
3437 it "can positively validate file content" do
35- expect { subject . call [ "non-empty" , "/usr/bin/test -s" ] } . to_not raise_error
38+ expect { subject . call [ "non-empty" , "#{ TESTEXE } -s" ] } . to_not raise_error
3639 end
3740
3841 it "can negatively validate file content" do
3942 expect {
40- subject . call [ "" , "/usr/bin/test -s" ]
43+ subject . call [ "" , "#{ TESTEXE } -s" ]
4144 } . to raise_error Puppet ::ParseError , /failed to validate.*test -s/
4245 end
4346 end
You can’t perform that action at this time.
0 commit comments