Sha256: 3b5b0f8bc0fcfaae8b690b47c020072ebb88a6515761726ba5195cad41c2f216

Contents?: true

Size: 1.04 KB

Versions: 14

Compression:

Stored size: 1.04 KB

Contents

# encoding: utf-8

require 'helper'

# Author: guapolo github.com/guapolo
class TestPhoneNumberMX < Test::Unit::TestCase
  def setup
    @tester = Faker::PhoneNumberMX
  end

  def test_mobile_phone_number
    assert_match /044 \d{2} \d{4} \d{4}/, @tester.mobile_phone_number
  end

  def test_home_work_phone_number
    assert_match /\d{2} \d{4} \d{4}/, @tester.home_work_phone_number
  end

  def test_phone_number
    10.times do
      assert_match /(044 )*\d{2} \d{4} \d{4}/, @tester.phone_number
    end
  end

  def test_international_mobile_phone_number
    assert_match /\+52 1 \d{2} \d{4} \d{4}/, @tester.international_mobile_phone_number
  end

  def test_international_home_work_phone_number
    assert_match /\+52 \d{2} \d{4} \d{4}/, @tester.international_home_work_phone_number
  end

  def test_international_phone_number
    10.times do
      assert_match /\+52 (\d )*\d{2} \d{4} \d{4}/, @tester.international_phone_number
    end
  end

  def test_toll_free_phone_number
    assert_match /01 800 \d{3} \d{4}/, @tester.toll_free_number
  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_mx.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/test/test_phone_number_mx.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/test/test_phone_number_mx.rb
ffaker-1.32.1 test/test_phone_number_mx.rb
ffaker-1.32.0 test/test_phone_number_mx.rb
ffaker-1.31.0 test/test_phone_number_mx.rb
ffaker-1.30.0 test/test_phone_number_mx.rb
ffaker-1.25.0 test/test_phone_number_mx.rb
ffaker-1.24.0 test/test_phone_number_mx.rb
ffakerer-1.0.2 test/test_phone_number_mx.rb
ffaker-1.23.0 test/test_phone_number_mx.rb
ffakerer-1.0.1 test/test_phone_number_mx.rb
ffaker-1.22.1 test/test_phone_number_mx.rb
ffaker-1.22.0 test/test_phone_number_mx.rb