Sha256: 6a89e29539d7d991b49dd976143437fef368f098f28564638cf0b987e8470f17

Contents?: true

Size: 562 Bytes

Versions: 5

Compression:

Stored size: 562 Bytes

Contents

require 'test/unit'
require 'iz'

class TestPhoneNumber < Test::Unit::TestCase

  def valid_phone_numbers
    ['(123) 456-7890', '11234567890', '1 123 456 7890', '123-456-7890']
  end

  def invalid_phone_numbers
    [nil, false, -1, '123456']
  end

  def test_that_phone_numbers_return_true
    valid_phone_numbers.each do |phone_number|
      assert Iz.phone_number?(phone_number)
    end
  end

  def test_that_invalid_phone_numbers_return_false
    invalid_phone_numbers.each do |phone_number|
      assert !Iz.phone_number?(phone_number)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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