Sha256: e2e5e8036a3a78b291afaa86e828eaeea090101053a3d80032304b891f900306

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

require 'test_helper'

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

# Tests for the Configurator class
class TestNonNilValidator < Test::Unit::TestCase
  def test_valid
    v = CLIUtils::NonNilValidator.new
    v.validate('asdasdasd')

    assert_equal(v.is_valid, true)
    assert_equal(v.message, 'Nil text not allowed')
  end

  def test_invalid_1
    v = CLIUtils::NonNilValidator.new
    v.validate('')

    assert_equal(v.is_valid, false)
    assert_equal(v.message, 'Nil text not allowed')
  end

  def test_invalid_2
    v = CLIUtils::NonNilValidator.new
    v.validate(nil)

    assert_equal(v.is_valid, false)
    assert_equal(v.message, 'Nil text not allowed')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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