Sha256: 82e1284a3f62a56c16b02e3ebbfb71a50448806fbf40cf5e3a36777e6a080199

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_relative 'helper'

class TestPhoneNumberUA < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFaker::PhoneNumberUA,
    :phone_number, :home_phone_number, :mobile_phone_number,
    :international_home_phone_number, :international_mobile_phone_number
  )

  def setup
    @tester = FFaker::PhoneNumberUA
  end

  def test_phone_number
    assert_match(/^(\+(380)\s|0)[0-9]{2}\s[0-9]{3}-[0-9]{4}$/, @tester.phone_number)
  end

  def test_home_phone_number
    assert_match(/^0{1}[0-9]{2}\s[0-9]{3}-[0-9]{4}$/, @tester.home_phone_number)
  end

  def test_mobile_phone_number
    assert_match(/^0{1}[0-9]{2}\s[0-9]{3}-[0-9]{4}$/, @tester.mobile_phone_number)
  end

  def test_international_home_phone_number
    assert_match(/^\+(380)\s[0-9]{2}\s[0-9]{3}-[0-9]{4}$/, @tester.international_home_phone_number)
  end

  def international_mobile_phone_number
    assert_match(/^\+(380)\s[0-9]{2}\s[0-9]{3}-[0-9]{4}$/,
                 @tester.international_mobile_phone_number)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ffaker-2.23.0 test/test_phone_number_ua.rb
ffaker-2.22.0 test/test_phone_number_ua.rb
ffaker-2.21.0 test/test_phone_number_ua.rb
ffaker-2.20.0 test/test_phone_number_ua.rb
ffaker-2.19.0 test/test_phone_number_ua.rb