Sha256: ad94fc2614f293ab45ab04c31a2917a032b6a68fd6e634954d1919b0d36728a2

Contents?: true

Size: 621 Bytes

Versions: 5

Compression:

Stored size: 621 Bytes

Contents

require 'test/unit'
require 'iz'

class TestAlphanumeric < Test::Unit::TestCase

  def valid_alphanumeric_values
    ['abc123', 'ABC123', '123', 'A', :foo]
  end

  def invalid_alphanumeric_values
    [nil, false, -1, '', 'http://google', 'https://google', 'www.google', 'foo!']
  end

  def test_that_alphanumeric_values_return_true
    valid_alphanumeric_values.each do |alphanumeric|
      assert Iz.alphanumeric?(alphanumeric)
    end
  end

  def test_that_invalid_alphanumeric_values_return_false
    invalid_alphanumeric_values.each do |alphanumeric|
      assert !Iz.alphanumeric?(alphanumeric)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iz-0.3.1 test/test_alphanumeric.rb
iz-0.3.0 test/test_alphanumeric.rb
iz-0.2.1 test/test_alphanumeric.rb
iz-0.2.0 test/test_alphanumeric.rb
iz-0.1.0 test/test_alphanumeric.rb