From fc90798459c8fcf27b8fbd643c7c0dcaf03dd375 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 21 Jan 2013 16:11:29 -0500 Subject: [PATCH] test option with nargs = 2 --- spec/yawpa_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/yawpa_spec.rb b/spec/yawpa_spec.rb index 52b0b5e..97288b9 100644 --- a/spec/yawpa_spec.rb +++ b/spec/yawpa_spec.rb @@ -39,5 +39,15 @@ describe Yawpa do opts[:opt].should eq('val') args.should eq(['arg']) end + + it "returns an option's values when nargs = 2" do + options = { + opt: {nargs: 2}, + } + params = ['--opt', 'val1', 'val2'] + opts, args = Yawpa.parse(params, options) + opts[:opt].should eq(['val1', 'val2']) + args.should eq([]) + end end end