summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Gracyk <jgracyk@squareup.com>2021-05-10 14:07:05 -0700
committerJoe Gracyk <jgracyk@squareup.com>2021-05-10 14:07:05 -0700
commit22e0e6e52f502493c00443a60c73809cfea539ff (patch)
tree1329bf0982a775e4549c24c4a19b5af3c3149ea4
parent6e6ed91d0d5c3e2197f0207894a01226446759de (diff)
downloadslop-22e0e6e52f502493c00443a60c73809cfea539ff.tar.gz
Add simple tests for StringOption
-rw-r--r--test/types_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/types_test.rb b/test/types_test.rb
index ed13d5c..a45302a 100644
--- a/test/types_test.rb
+++ b/test/types_test.rb
@@ -1,5 +1,19 @@
require 'test_helper'
+describe Slop::StringOption do
+ before do
+ @options = Slop::Options.new
+ @age = @options.string "--name"
+ @minus = @options.string "--zipcode"
+ @result = @options.parse %w(--name Foo --zipcode 12345)
+ end
+
+ it "returns the value as a string" do
+ assert_equal "Foo", @result[:name]
+ assert_equal "12345", @result[:zipcode]
+ end
+end
+
describe Slop::SymbolOption do
before do
@options = Slop::Options.new