Sha256: 333ec6c19e1fe787fd91e05c9739445da350d90e2e856bc2ba5a0343494a753a

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

# encoding: utf-8

# => author: wiseleyb
# => email: wiseleyb@gmail.com
require 'helper'

class TestPhoneNumberAU < Test::Unit::TestCase
  def setup
    @tester = Faker::PhoneNumberAU
  end

  def test_mobile_phone_prefix
    assert Faker::PhoneNumberAU::MobileOperatorsPrefix.include?(@tester.mobile_phone_prefix)
  end

  def test_home_work_phone_prefix
    assert Faker::PhoneNumberAU::HomeWorkOperatorsPrefix.include?(@tester.home_work_phone_prefix)
  end
  
  def test_phone_prefix
    assert Faker::PhoneNumberAU::OperatorsPrefix.include?(@tester.phone_prefix)
  end
  
  def test_mobile_phone_number
    assert_match /04\d{2} \d{3} \d{3}/, Faker::PhoneNumberAU.mobile_phone_number
  end

  def test_home_work_phone_number
    assert_match /\(\d{2}\) \d{4} \d{4}/, Faker::PhoneNumberAU.home_work_phone_number
  end

  def test_phone_number
    10.times do 
      assert_match /(04\d{2} \d{3} \d{3}|\(\d{2}\) \d{4} \d{4})/, Faker::PhoneNumberAU.phone_number
    end
  end

  def test_international_mobile_phone_number
    assert_match /\+61 4 \d{4} \d{4}/, Faker::PhoneNumberAU.international_mobile_phone_number
  end

  def test_international_home_work_phone_number
    assert_match /\+61 \d{1} \d{4} \d{4}/, Faker::PhoneNumberAU.international_home_work_phone_number
  end

  def test_international_phone_number
    10.times do
      assert_match /\+61 \d{1} \d{4} \d{4}/, Faker::PhoneNumberAU.international_phone_number
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffaker-1.14.0 test/test_phone_number_au.rb
ffaker-1.13.0 test/test_phone_number_au.rb
ffaker-1.12.1 test/test_phone_number_au.rb
ffaker-1.12.0 test/test_phone_number_au.rb