class PhoneNumberValidatorTest

Phone Number Validator Test Class

Inherits from:

Test::Unit::TestCase

Public Instance Methods

test_invalid_phone_number() click to toggle source

Negative Test

Inputs an invalid phone number and expects the output to be false

# File test/test_phone_number_validator.rb, line 24
def test_invalid_phone_number
  assert_equal false,
  PhoneNumberValidator.validate_phone_number('94643823637337')
end
test_valid_phone_number() click to toggle source

Positive Test

Inputs a valid phone number and expects the output to be true

# File test/test_phone_number_validator.rb, line 15
def test_valid_phone_number
  assert_equal true,
  PhoneNumberValidator.validate_phone_number('+1 (949) 355-6244 ext. 198842')
end