raise exception on unknown option
This commit is contained in:
1 parent
b2b0d90c4d
commit
56e644e16e
3 files changed
+35
-5
No files matched your search
+9
-3
@@ -3,11 +3,17 @@ require 'spec_helper'
|
||||
describe Yawpa do
|
||||
describe 'parse' do
|
||||
it "returns everything as arguments when no options present" do
|
||||
config = { }
|
||||
options = { }
|
||||
params = ['one', 'two', 'three', 'four']
|
||||
opts, args = Yawpa.parse(config, params)
|
||||
opts.should eq([])
|
||||
opts, args = Yawpa.parse(params, options)
|
||||
opts.should eq({})
|
||||
args.should eq(params)
|
||||
end
|
||||
|
||||
it "raises an exception when an invalid option is passed" do
|
||||
options = { }
|
||||
params = ['one', '--option', 'two']
|
||||
expect { Yawpa.parse(params, options) }.to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user