Sha256: 1c8dc44b68fc79b15124e9f10757a1416afa6d83080f3d60aea71d7eaa19fa12

Contents?: true

Size: 1.8 KB

Versions: 20

Compression:

Stored size: 1.8 KB

Contents

require "spec_helper"

module Beaker
  module Options
    describe CommandLineParser do

      let(:parser) {Beaker::Options::CommandLineParser.new}
      let(:test_opts) {["-h", "vcloud.cfg", "--debug", "--tests", "test.rb", "--help"]}
      let(:full_opts) {["--hosts", "host.cfg", "--options", "opts_file", "--type", "pe", "--helper", "path_to_helper", "--load-path", "load_path", "--tests", "test1.rb,test2.rb,test3.rb", "--pre-suite", "pre_suite.rb", "--post-suite", "post_suite.rb", "--no-provision", "--preserve-hosts", "always", "--root-keys", "--keyfile", "../.ssh/id_rsa", "--install", "gitrepopath", "-m", "module", "-q", "--dry-run", "--no-ntp", "--repo-proxy", "--add-el-extras", "--config", "anotherfile.cfg", "--fail-mode", "fast", "--no-color", "--version", "--log-level", "info", "--package-proxy", "http://192.168.100.1:3128"]}

      it "can correctly read command line input" do
        expect(parser.parse(test_opts)).to be === {:hosts_file=>"vcloud.cfg", :log_level=>"debug", :tests=>"test.rb", :help=>true}
      end

      it "supports all our command line options" do
        expect(parser.parse(full_opts)).to be === {:hosts_file=>"anotherfile.cfg", :options_file=>"opts_file", :type=>"pe", :helper=>"path_to_helper", :load_path=>"load_path", :tests=>"test1.rb,test2.rb,test3.rb", :pre_suite=>"pre_suite.rb", :post_suite=>"post_suite.rb", :provision=>false, :preserve_hosts=>"always", :root_keys=>true, :keyfile=>"../.ssh/id_rsa", :install=>"gitrepopath", :modules=>"module", :quiet=>true, :dry_run=>true, :timesync=>false, :repo_proxy=>true, :add_el_extras=>true, :fail_mode=>"fast", :color=>false, :version=>true, :log_level=>"info", :package_proxy => "http://192.168.100.1:3128"}
      end

      it "can produce a usage description" do
        expect{parser.usage}.to_not raise_error 
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
beaker-1.21.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.20.1 spec/beaker/options/command_line_parser_spec.rb
beaker-1.20.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.19.1 spec/beaker/options/command_line_parser_spec.rb
beaker-1.19.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.18.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.7 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.6 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.5 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.4 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.3 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.2 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.1 spec/beaker/options/command_line_parser_spec.rb
beaker-1.17.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.16.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.15.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.14.1 spec/beaker/options/command_line_parser_spec.rb
beaker-1.14.0 spec/beaker/options/command_line_parser_spec.rb
beaker-1.13.1 spec/beaker/options/command_line_parser_spec.rb
beaker-1.13.0 spec/beaker/options/command_line_parser_spec.rb