Sha256: e2d1ae83fe5ae185dd726749a3b402d3e43dad7f7ed9c765145fbab2ad384f8d

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8

require 'helper'

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

  assert_methods_are_deterministic(
    FFaker::PhoneNumberSG,
    :voip_number, :fixed_line_number, :mobile_number, :mobile_or_pager_number,
    :international_toll_free_number, :toll_free_number, :premium_service_number,
    :phone_number
  )

  def setup
    @tester = FFaker::PhoneNumberSG
  end

  def test_voip_number
    assert_match(/3\d{3}\s\d{4}/, @tester.voip_number)
  end

  def test_fixed_line_number
    assert_match(/6\d{3}\s\d{4}/, @tester.fixed_line_number)
  end

  def test_mobile_number
    assert_match(/8\d{3}\s\d{4}/, @tester.mobile_number)
  end

  def test_mobile_or_pager_number
    assert_match(/9\d{3}\s\d{4}/, @tester.mobile_or_pager_number)
  end

  def test_international_toll_free_number
    assert_match(/800\s\d{3}\s\d{4}/, @tester.international_toll_free_number)
  end

  def test_toll_free_number
    assert_match(/1800\s\d{3}\s\d{4}/, @tester.toll_free_number)
  end

  def test_premium_service_number
    assert_match(/1900\s\d{3}\s\d{4}/, @tester.premium_service_number)
  end

  def test_phone_number
    10.times do
      assert_match(/[6,8,9]\d{3}\s\d{4}/, @tester.phone_number)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ffaker-2.11.0 test/test_phone_number_sg.rb
ffaker-2.10.0 test/test_phone_number_sg.rb
ffaker-2.9.0 test/test_phone_number_sg.rb
ffaker-2.8.1 test/test_phone_number_sg.rb
ffaker-2.8.0 test/test_phone_number_sg.rb
ffaker-2.7.0 test/test_phone_number_sg.rb
ffaker-2.6.0 test/test_phone_number_sg.rb
ffaker-2.5.0 test/test_phone_number_sg.rb
ffaker-2.4.0 test/test_phone_number_sg.rb
ffaker-2.3.0 test/test_phone_number_sg.rb