Sha256: 74502e421ced28529e502c73ebc23bc83c8f565cfd4b7f0f37a5c4788f671f9c

Contents?: true

Size: 600 Bytes

Versions: 3

Compression:

Stored size: 600 Bytes

Contents

require 'test_helper'

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

# Tests for the Configurator class
class TestNumberValidator < Test::Unit::TestCase
  def test_valid
    v = CLIUtils::NumberValidator.new
    v.validate('1234.112')

    assert_equal(v.is_valid, 0)
    assert_equal(v.message, 'Response is not a number: 1234.112')
  end

  def test_invalid
    v = CLIUtils::NumberValidator.new
    v.validate('abcdefg')

    assert_not_equal(v.is_valid, 0)
    assert_equal(v.message, 'Response is not a number: abcdefg')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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