Fix up Rubinius specific library specs.
[rbx.git] / spec / library / options / option_spec.rb
blobea439266f68fdbd44cb299c6de7453af8af5359d
1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require 'options'
4 describe "Options#option" do
5   before { @o = Options.new }
7   it "takes a string with three parts: short and long options and a description" do
8     lambda { @o.option '-h --help Help' }.should_not raise_error
9   end
11   it "does not accept the definition string without leading dashes" do
12     lambda { @o.option 'h help Help' }.should raise_error(ArgumentError)
13   end
15   it "requires that all three parts are present" do
16     lambda { @o.option '-h Help'  }.should raise_error(ArgumentError)
17     lambda { @o.option '--h Help' }.should raise_error(ArgumentError)
18   end
20   it "requires that the three parts are in order" do
21     lambda { @o.option '--help -h Help' }.should raise_error(ArgumentError)
22     lambda { @o.option '-h Help --help' }.should raise_error(ArgumentError)
23   end
25   it "optionally takes a parameter to designate number of arguments wanted" do
26     lambda { @o.option '-f --file File', :one }.should_not raise_error
27   end
28 end