diff options
author | Lee Jarvis <ljjarvis@gmail.com> | 2013-01-14 21:53:16 +0000 |
---|---|---|
committer | Lee Jarvis <ljjarvis@gmail.com> | 2013-01-14 21:53:16 +0000 |
commit | bbbf27a109dc40087a58c0d61c76e02b629c7fb7 (patch) | |
tree | 371505ecef00386b365b003bcce6264493e7d5aa /test | |
parent | bb20f6cf59bb370950763b2fd1fcea919be48bc4 (diff) | |
download | slop-bbbf27a109dc40087a58c0d61c76e02b629c7fb7.tar.gz |
ensure parse! removes the command and its options
Diffstat (limited to 'test')
-rw-r--r-- | test/commands_test.rb | 20 |
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 |