diff options
author | danielsdeleo <dan@getchef.com> | 2014-04-25 10:41:08 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2014-04-25 10:58:28 -0700 |
commit | e7e86b271d5d381de0664fb66733efb4b1817911 (patch) | |
tree | 64475cd0f14e97f0d5945aec808a07f371ec472e /spec | |
parent | 306a81dbefbeb285631f1cb2b5486367d3f1c1e8 (diff) | |
download | mixlib-cli-e7e86b271d5d381de0664fb66733efb4b1817911.tar.gz |
Add API to access option parser without parsing options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/mixlib/cli_spec.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/mixlib/cli_spec.rb b/spec/mixlib/cli_spec.rb index 685af4e..fba376c 100644 --- a/spec/mixlib/cli_spec.rb +++ b/spec/mixlib/cli_spec.rb @@ -91,16 +91,15 @@ describe Mixlib::CLI do end end - describe "parse_options" do + describe "opt_parser" do + it "should set the banner in opt_parse" do - @cli.parse_options([]) @cli.opt_parser.banner.should == @cli.banner end it "should present the arguments in the banner" do TestCLI.option(:config_file, :short => "-l LOG") @cli = TestCLI.new - @cli.parse_options([]) @cli.opt_parser.to_s.should =~ /-l LOG/ end @@ -108,7 +107,6 @@ describe Mixlib::CLI do TestCLI.option(:config_file, :short => "-l LOG") TestCLI.option(:help, :short => "-h", :boolean => true, :on => :tail) @cli = TestCLI.new - @cli.parse_options([]) @cli.opt_parser.to_s.split("\n").last.should =~ /-h/ end @@ -116,7 +114,6 @@ describe Mixlib::CLI do TestCLI.option(:config_file, :short => "-l LOG") TestCLI.option(:help, :short => "-h", :boolean => true, :on => :head) @cli = TestCLI.new - @cli.parse_options([]) @cli.opt_parser.to_s.split("\n")[1].should =~ /-h/ end @@ -125,13 +122,15 @@ describe Mixlib::CLI do TestCLI.option(:beta, :short => "-b BETA") TestCLI.option(:zeta, :short => "-z ZETA") @cli = TestCLI.new - @cli.parse_options([]) output_lines = @cli.opt_parser.to_s.split("\n") output_lines[1].should =~ /-a ALPHA/ output_lines[2].should =~ /-b BETA/ output_lines[3].should =~ /-z ZETA/ end + end + + describe "parse_options" do it "should set the corresponding config value for non-boolean arguments" do TestCLI.option(:config_file, :short => "-c CONFIG") @cli = TestCLI.new |