Sha256: db6ba60de6fedb59c658e745315f9602602dd3c49a5191bfca784554bdf91d24

Contents?: true

Size: 589 Bytes

Versions: 3

Compression:

Stored size: 589 Bytes

Contents

require 'test_helper'

require File.join(File.dirname(__FILE__), '..', '..', 'lib/cliutils/prefs/pref_validators/date_validator')

# Tests for the Configurator class
class TestDateValidator < Test::Unit::TestCase
  def test_valid
    v = CLIUtils::DateValidator.new
    v.validate('2014-02-01')

    assert_equal(v.is_valid, true)
    assert_equal(v.message, 'Response is not a date: 2014-02-01')
  end

  def test_invalid
    v = CLIUtils::DateValidator.new
    v.validate('!@&^')

    assert_equal(v.is_valid, false)
    assert_equal(v.message, 'Response is not a date: !@&^')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cliutils-2.1.4 test/validator_tests/date_validator_test.rb
cliutils-2.1.3 test/validator_tests/date_validator_test.rb
cliutils-2.1.2 test/validator_tests/date_validator_test.rb