Sha256: bcd0c82e218e1234ff0375011ee3046b7e03635dd037a8fc01bc0f43bb61df87
Contents?: true
Size: 685 Bytes
Versions: 2
Compression:
Stored size: 685 Bytes
Contents
require File.expand_path 'test_helper', File.dirname(__FILE__) class TestArgsParserValidator < MiniTest::Unit::TestCase def setup @argv = ['--url', 'hptt://shokai.org'] @@err = nil @@name = nil @@value = nil @parser = ArgsParser.parse @argv do arg :url, 'URL' validate :url, 'invalid URL' do |v| v =~ Regexp.new("^https?://.+$") end on_validate_error do |err, name, value| @@err = err @@name = name @@value = value end end end def test_validate_error assert @@name == :url assert @@value == 'hptt://shokai.org' assert @@err.class == ArgsParser::ValidationError end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
args_parser-0.1.4 | test/test_validator.rb |
args_parser-0.1.3 | test/test_validator.rb |