From e7521a65b01560ac997ccb907d33e4b3795533a7 Mon Sep 17 00:00:00 2001 From: Laurent Arnoud Date: Sun, 17 May 2015 16:57:18 +0200 Subject: Added support for Regexp Used to work on 3.6 See https://github.com/leejarvis/slop/commit/e2775e27d866ba85f6b6bf50536135ee4e93c93e --- test/types_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/types_test.rb b/test/types_test.rb index 39cccc9..81ae3ba 100644 --- a/test/types_test.rb +++ b/test/types_test.rb @@ -100,3 +100,16 @@ describe Slop::NullOption do assert_equal({}, @result.to_hash) end end + +describe Slop::RegexpOption do + before do + @options = Slop::Options.new + @exclude = @options.regexp "--exclude" + @exclude_value = "redirect|news" + @result = @options.parse %W(--exclude #{@exclude_value}) + end + + it "returns the value as a Regexp" do + assert_equal Regexp.new(@exclude_value), @result[:exclude] + end +end -- cgit v1.2.1