Sha256: 2d64dbbe63c6ca995c49311a9b5bc825fe807d3a067c1feecec5284e57546c2b

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require 'helper'

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

  assert_methods_are_deterministic(
    FFaker::PhoneNumberTW,
    :mobile_phone_number, :home_work_phone_number, :phone_number,
    :international_mobile_phone_number, :international_home_work_phone_number,
    :international_phone_number
  )

  def setup
    @tester = FFaker::PhoneNumberTW
  end

  def test_mobile_phone_number
    assert_match(/09\d{2}-\d{3}-\d{3}/, @tester.mobile_phone_number)
  end

  def test_home_work_phone_number
    assert_match(/\(0\d\) \d{3,4}-\d{4}/, @tester.home_work_phone_number)
  end

  def test_phone_number
    10.times do
      assert_match(/\(*0\d{1,3}\)*[\s-]\d{3,4}-\d{3,4}/, @tester.phone_number)
    end
  end

  def test_international_mobile_phone_number
    assert_match(/\+886-9\d{2}-\d{3}-\d{3}/,
                 @tester.international_mobile_phone_number)
  end

  def test_international_home_work_phone_number
    assert_match(/\+886-\d{1}-\d{3,4}-\d{4}/,
                 @tester.international_home_work_phone_number)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ffaker-2.18.0 test/test_phone_number_tw.rb
ffaker-2.17.0 test/test_phone_number_tw.rb
ffaker-2.16.0 test/test_phone_number_tw.rb
ffaker-2.15.0 test/test_phone_number_tw.rb
ffaker-2.14.0 test/test_phone_number_tw.rb
ffaker-2.13.0 test/test_phone_number_tw.rb
ffaker-2.12.0 test/test_phone_number_tw.rb