summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2014-11-19 17:59:42 +0000
committerLee Jarvis <ljjarvis@gmail.com>2014-11-19 18:02:54 +0000
commitbc7a98183f63cad42cc46361b603a85113e78102 (patch)
tree91fba4c3a70975b54777970b3abf5f8b5f62a068 /test
parentb2a7405975debde3d0344d348bc1d56aff37bdc2 (diff)
downloadslop-bc7a98183f63cad42cc46361b603a85113e78102.tar.gz
Add MissingArgument error processing, and suppressing
Diffstat (limited to 'test')
-rw-r--r--test/error_test.rb17
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