diff options
author | Lee Jarvis <ljjarvis@gmail.com> | 2014-11-19 17:59:42 +0000 |
---|---|---|
committer | Lee Jarvis <ljjarvis@gmail.com> | 2014-11-19 18:02:54 +0000 |
commit | bc7a98183f63cad42cc46361b603a85113e78102 (patch) | |
tree | 91fba4c3a70975b54777970b3abf5f8b5f62a068 /test/error_test.rb | |
parent | b2a7405975debde3d0344d348bc1d56aff37bdc2 (diff) | |
download | slop-bc7a98183f63cad42cc46361b603a85113e78102.tar.gz |
Add MissingArgument error processing, and suppressing
Diffstat (limited to 'test/error_test.rb')
-rw-r--r-- | test/error_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/error_test.rb b/test/error_test.rb new file mode 100644 index 0000000..4528623 --- /dev/null +++ b/test/error_test.rb @@ -0,0 +1,17 @@ +require 'test_helper' + +# All raised errors tested here + +describe Slop::MissingArgument do + it "raises when an argument is missing" do + opts = Slop::Options.new + opts.string "-n", "--name" + assert_raises(Slop::MissingArgument) { opts.parse %w(--name) } + end + + it "does not raise when errors are suppressed" do + opts = Slop::Options.new(suppress_errors: true) + opts.string "-n", "--name" + opts.parse %w(--name) + end +end |