summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorRein Henrichs <reinh@reinh.com>2009-10-13 18:21:06 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-10-15 15:58:26 +1100
commit8a7308249783fc75d450fc2428cba52a5ad30a10 (patch)
tree8b4b9557fb169fac7a2f12778df09c3b5d864812 /spec
parent54ded1bd2b8c023d6e480c21f1b2b03f3b7859ba (diff)
downloadpuppet-8a7308249783fc75d450fc2428cba52a5ad30a10.tar.gz
puppet-8a7308249783fc75d450fc2428cba52a5ad30a10.tar.xz
puppet-8a7308249783fc75d450fc2428cba52a5ad30a10.zip
Fix #2707 config_version fails more helpfully
Use Puppet::Util.execute to run the config_version command and reraise its potential Puppet::ExecutionFailure exception as a more useful Pupppet::ParseError
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/parser/parser.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb
index 842dc1904..78caf18b0 100755
--- a/spec/unit/parser/parser.rb
+++ b/spec/unit/parser/parser.rb
@@ -324,9 +324,17 @@ describe Puppet::Parser do
it "should use the output of the config_version setting if one is provided" do
Puppet.settings.stubs(:[]).with(:config_version).returns("/my/foo")
- @parser.expects(:`).with("/my/foo").returns "output\n"
+ Puppet::Util.expects(:execute).with(["/my/foo"]).returns "output\n"
@parser.version.should == "output"
end
+
+ it "should raise a puppet parser error if executing config_version fails" do
+ Puppet.settings.stubs(:[]).with(:config_version).returns("test")
+ Puppet::Util.expects(:execute).raises(Puppet::ExecutionFailure.new("msg"))
+
+ lambda { @parser.version }.should raise_error(Puppet::ParseError)
+ end
+
end
describe Puppet::Parser,"when looking up definitions" do