Sha256: 0e1d7b8a0ff17ae4a7ddad8c0583c6902a11655c9231f4c86d402619922a3d2b
Contents?: true
Size: 1.47 KB
Versions: 9
Compression:
Stored size: 1.47 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' require File.dirname(__FILE__) + '/../../../lib/poolparty/helpers/optioner' describe "Option Parser" do describe "options" do before(:each) do @op = PoolParty::Optioner.new([], {:abstract => true}) @op.parse_options end it "should set the dsl_options as an Hash" do @op.dsl_options.class.should == Hash end it "should have the verbose option set to false by default" do @op.verbose?.should == false end it "should call a method called on it that is not defined on the options if they exist" do @op.dsl_options.should_receive(:[]).with(:verbose).at_least(1).and_return true @op.verbose end it "should exit after displaying the help message" do hide_output do lambda { @o = PoolParty::Optioner.new(["-h"], {:parse_options => false}) @o.should_receive(:process_options).once @o.parse_options } end end end describe "parse_args" do before(:each) do @op = PoolParty::Optioner.new(%w( -v -i 1 five six -x), {:abstract => true, :parse_options => false}) end it "should have an array of default boolean args" do @op.boolean_args.sort.should == ['--debug', '-V', '-h', '-t', '-v'] end it "should split ARGV into flagged and unflagged arg arrays" do @op.unflagged_args.sort.sort.should == ["five", "six"] @op.flagged_args.should == ["-v", "-i", "1", "-x"] end end end
Version data entries
9 entries across 9 versions & 2 rubygems