diff options
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 |