diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-05-24 17:04:17 -0700 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 3696d951f70f5b94b49619dfbc57138d5241bbb8 (patch) | |
| tree | 9032825792f576a84311d4025fea316bf3ae565d /spec | |
| parent | 0fc41aed7056e645f1d41a7ef6a00a34344dde38 (diff) | |
[#3865] External subcommands
This patch allows the puppet single-executable to invoke external,
hyphenated subcommands, much like how git does.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/unit/util/command_line.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/util/command_line.rb b/spec/unit/util/command_line.rb index 7413e57d1..31b2d1b03 100644 --- a/spec/unit/util/command_line.rb +++ b/spec/unit/util/command_line.rb @@ -83,4 +83,26 @@ describe Puppet::Util::CommandLine do command_line.legacy_executable_name.should == "puppetmasterd" end + describe "when the subcommand is not implemented" do + it "should find and invoke an executable with a hyphenated name" do + commandline = Puppet::Util::CommandLine.new("puppet", ['whatever', 'argument'], @tty) + Puppet::Util.expects(:binary).with('puppet-whatever').returns('/dev/null/puppet-whatever') + commandline.expects(:system).with('/dev/null/puppet-whatever', 'argument') + + commandline.execute + end + + describe "and an external implementation cannot be found" do + it "should abort and show the usage message" do + commandline = Puppet::Util::CommandLine.new("puppet", ['whatever', 'argument'], @tty) + Puppet::Util.expects(:binary).with('puppet-whatever').returns(nil) + commandline.expects(:system).never + + commandline.expects(:usage_message).returns("the usage message") + commandline.expects(:abort).with{|x| x =~ /the usage message/}.raises("stubbed abort") + + lambda{ commandline.execute }.should raise_error('stubbed abort') + end + end + end end |
