Sha256: c46028abbb95ca0eba5e8d285f1cdad29a240877e54855f2d6c9aaaa93398a54

Contents?: true

Size: 1.4 KB

Versions: 14

Compression:

Stored size: 1.4 KB

Contents

# encoding: utf-8

require 'helper'

# Author: wiseleyb<wiseleyb@gmail.com>
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{1,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 \d{1,2} \d{4} \d{4}/, Faker::PhoneNumberAU.international_mobile_phone_number
  end

  def test_international_home_work_phone_number
    assert_match /\+61 \d{1,2} \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,2} \d{4} \d{4}/, Faker::PhoneNumberAU.international_phone_number
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/test/test_phone_number_au.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/test/test_phone_number_au.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/test/test_phone_number_au.rb
ffaker-1.32.1 test/test_phone_number_au.rb
ffaker-1.32.0 test/test_phone_number_au.rb
ffaker-1.31.0 test/test_phone_number_au.rb
ffaker-1.30.0 test/test_phone_number_au.rb
ffaker-1.25.0 test/test_phone_number_au.rb
ffaker-1.24.0 test/test_phone_number_au.rb
ffakerer-1.0.2 test/test_phone_number_au.rb
ffaker-1.23.0 test/test_phone_number_au.rb
ffakerer-1.0.1 test/test_phone_number_au.rb
ffaker-1.22.1 test/test_phone_number_au.rb
ffaker-1.22.0 test/test_phone_number_au.rb