summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorAdrien Thebo <git@somethingsinistral.net>2013-12-09 14:18:17 -0800
committerAdrien Thebo <git@somethingsinistral.net>2013-12-09 14:18:17 -0800
commit224b8f9a191f635b03ee900a9bf87bfdb0f1a6ed (patch)
tree39049ae7cea0f798b27575ab5817978030a17a07 /spec/unit
parent76514d47590f7d778db29b0d1473e99f49607c0d (diff)
parenta1978698ef0909c0954812176316a7f28b0db986 (diff)
downloadpuppet-stdlib-224b8f9a191f635b03ee900a9bf87bfdb0f1a6ed.tar.gz
puppet-stdlib-224b8f9a191f635b03ee900a9bf87bfdb0f1a6ed.tar.bz2
Merge pull request #200 from bobtfish/fix_tests_on_osx
Fix the tests on osx
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/puppet/parser/functions/validate_cmd_spec.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb b/spec/unit/puppet/parser/functions/validate_cmd_spec.rb
index 0aa3ba7..a86cb01 100644
--- a/spec/unit/puppet/parser/functions/validate_cmd_spec.rb
+++ b/spec/unit/puppet/parser/functions/validate_cmd_spec.rb
@@ -1,5 +1,8 @@
require 'spec_helper'
+TESTEXE = File.exists?('/usr/bin/test') ? '/usr/bin/test' : '/bin/test'
+TOUCHEXE = File.exists?('/usr/bin/touch') ? '/usr/bin/touch' : '/bin/touch'
+
describe Puppet::Parser::Functions.function(:validate_cmd) do
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
@@ -19,8 +22,8 @@ describe Puppet::Parser::Functions.function(:validate_cmd) do
describe "on validation failure" do
it "includes the command error output" do
expect {
- subject.call ['', '/bin/touch /cant/touch/this']
- }.to raise_error Puppet::ParseError, /cannot touch/
+ subject.call ['', "#{TOUCHEXE} /cant/touch/this"]
+ }.to raise_error Puppet::ParseError, /(cannot touch|o such file or)/
end
it "includes the command return value" do
@@ -32,12 +35,12 @@ describe Puppet::Parser::Functions.function(:validate_cmd) do
describe "when performing actual validation" do
it "can positively validate file content" do
- expect { subject.call ["non-empty", "/usr/bin/test -s"] }.to_not raise_error
+ expect { subject.call ["non-empty", "#{TESTEXE} -s"] }.to_not raise_error
end
it "can negatively validate file content" do
expect {
- subject.call ["", "/usr/bin/test -s"]
+ subject.call ["", "#{TESTEXE} -s"]
}.to raise_error Puppet::ParseError, /failed to validate.*test -s/
end
end