Sha256: 2cafe294ea58a7e2d92ad53b7bc2233a3f95e89c63cf31daeb261644f1829d0c

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

require 'test_helper'

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

# Tests for the Configurator class
class TestAlphanumericValidator < Test::Unit::TestCase
  def test_valid
    v = CLIUtils::AlphanumericValidator.new
    v.validate('bachya91238 ')

    assert_equal(v.is_valid, 0)
    assert_equal(v.message, 'Response is not alphanumeric: bachya91238 ')
  end

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

    assert_not_equal(v.is_valid, 0)
    assert_equal(v.message, 'Response is not alphanumeric: !@&^')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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