From c7c21ca97edc8337cff989d133f441f2b4fe1a9f Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 21 Jan 2013 16:12:34 -0500 Subject: [PATCH] test exception on not enough arguments to option --- spec/yawpa_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/yawpa_spec.rb b/spec/yawpa_spec.rb index 97288b9..12c80a2 100644 --- a/spec/yawpa_spec.rb +++ b/spec/yawpa_spec.rb @@ -49,5 +49,13 @@ describe Yawpa do opts[:opt].should eq(['val1', 'val2']) args.should eq([]) end + + it "raises an exception when not enough arguments for an option are given" do + options = { + opt: {nargs: 2}, + } + params = ['--opt', 'val'] + expect { Yawpa.parse(params, options) }.to raise_error + end end end