diff options
-rw-r--r-- | lib/puppet/application.rb | 3 | ||||
-rwxr-xr-x | spec/unit/application_spec.rb | 14 |
2 files changed, 3 insertions, 14 deletions
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index 05b7d466f..0a8fbc155 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -264,7 +264,6 @@ class Application self.send(fname, value) end end - @option_parser.default_argv = self.command_line.args @option_parser end @@ -337,7 +336,7 @@ class Application # scan command line argument begin - self.option_parser.parse! + self.option_parser.parse!(self.command_line.args) rescue OptionParser::ParseError => detail $stderr.puts detail $stderr.puts "Try 'puppet #{command_line.subcommand_name} --help'" diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 3c354cce9..433809172 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -194,7 +194,6 @@ describe Puppet::Application do it "should create a new option parser when needed" do option_parser = stub "option parser" option_parser.stubs(:on) - option_parser.stubs(:default_argv=) OptionParser.expects(:new).returns(option_parser).once @app.option_parser.should == option_parser @app.option_parser.should == option_parser @@ -203,7 +202,6 @@ describe Puppet::Application do it "should pass the banner to the option parser" do option_parser = stub "option parser" option_parser.stubs(:on) - option_parser.stubs(:default_argv=) @app.class.instance_eval do banner "banner" end @@ -213,15 +211,6 @@ describe Puppet::Application do @app.option_parser end - it "should set the optionparser's args to the command line args" do - option_parser = stub "option parser" - option_parser.stubs(:on) - option_parser.expects(:default_argv=).with(%w{ fake args }) - @app.command_line.stubs(:args).returns(%w{ fake args }) - OptionParser.expects(:new).returns(option_parser) - @app.option_parser - end - it "should get options from Puppet.settings.optparse_addargs" do Puppet.settings.expects(:optparse_addargs).returns([]) @@ -237,7 +226,8 @@ describe Puppet::Application do end it "should ask OptionParser to parse the command-line argument" do - @app.option_parser.expects(:parse!) + @app.command_line.stubs(:args).returns(%w{ fake args }) + @app.option_parser.expects(:parse!).with(%w{ fake args }) @app.parse_options end |