summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2013-01-14 21:53:16 +0000
committerLee Jarvis <ljjarvis@gmail.com>2013-01-14 21:53:16 +0000
commitbbbf27a109dc40087a58c0d61c76e02b629c7fb7 (patch)
tree371505ecef00386b365b003bcce6264493e7d5aa /test
parentbb20f6cf59bb370950763b2fd1fcea919be48bc4 (diff)
downloadslop-bbbf27a109dc40087a58c0d61c76e02b629c7fb7.tar.gz
ensure parse! removes the command and its options
Diffstat (limited to 'test')
-rw-r--r--test/commands_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/commands_test.rb b/test/commands_test.rb
index 6a48feb..8f0e84a 100644
--- a/test/commands_test.rb
+++ b/test/commands_test.rb
@@ -2,5 +2,25 @@ require 'helper'
class CommandsTest < TestCase
+ def setup
+ @opts = Slop.new do |o|
+ o.on :v, :version
+ o.command :add do |add|
+ add.on :v, 'verbose mode'
+ end
+ end
+ end
+
+ test "parse! removes the command AND its options" do
+ items = %w'add -v'
+ @opts.parse! items
+ assert_equal [], items
+ end
+
+ test "parse does not remove the command or its options" do
+ items = %w'add -v'
+ @opts.parse items
+ assert_equal ['add', '-v'], items
+ end
end