summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-04-22 12:04:10 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit7656ba73ddfd883b36a01c81147ae69e80773bce (patch)
tree5bc7cad1485bb9749ce387336b30794e3ae93aa1 /spec
parent63e2e56d3172bdc80aaca5f5ddde5811728e3c76 (diff)
feature #2276 Single Executable: CommandLine can be instantiated
refactor CommandLine to be an object Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/util/command_line.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/util/command_line.rb b/spec/unit/util/command_line.rb
index a07438f9e..e20f51a99 100644
--- a/spec/unit/util/command_line.rb
+++ b/spec/unit/util/command_line.rb
@@ -93,4 +93,21 @@ describe Puppet::Util::CommandLine do
Puppet::Util::CommandLine.legacy_executable_name("puppetmasterd", [], @tty).should == "puppetmasterd"
end
+ describe "when instantiated" do
+ it "should provide the results of subcommand and args" do
+ Puppet::Util::CommandLine.expects(:subcommand_and_args).with("puppet", [], @pipe).returns(["command", ['args']])
+ commandline = Puppet::Util::CommandLine.new("puppet", [], @pipe)
+
+ commandline.subcommand_name.should == 'command'
+ commandline.args.should == ['args']
+ end
+
+ it "should provide the legacy executable name" do
+ Puppet::Util::CommandLine.expects(:subcommand_and_args).with("puppet", ['master'], @pipe).returns(["master", []])
+ commandline = Puppet::Util::CommandLine.new("puppet", ['master'], @pipe)
+
+ commandline.legacy_executable_name.should == 'puppetmasterd'
+ end
+ end
+
end