Sha256: c01fb86c3298df5fff73f9e8303944a3cc0cabe363d2847b2766446d96f29013

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

require 'helper'

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

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

  def setup
    @tester = FFaker::PhoneNumberFR
  end

  def test_phone_number
    10.times do
      assert_match(/^0[1-9](\s?\d{2}){4}$/, @tester.phone_number)
    end
  end

  def test_home_work_phone_number
    assert_match(/^0([1-5]|[8-9])(\s?\d{2}){4}$/,
                 @tester.home_work_phone_number)
  end

  def test_mobile_phone_number
    assert_match(/^0([6-7])(\s?\d{2}){4}$/,
                 @tester.mobile_phone_number)
  end

  def test_international_phone_number
    10.times do
      assert_match(/^(\+|00)33\s?([1-9])(\s?\d{2}){4}$/,
                   @tester.international_phone_number)
    end
  end

  def test_international_mobile_phone_number
    assert_match(/^(\+|00)33\s?([6-7])(\s?\d{2}){4}$/,
                 @tester.international_mobile_phone_number)
  end

  def test_international_home_work_phone_number
    assert_match(/^(\+|00)33\s?([1-5]|[8-9])(\s?\d{2}){4}$/,
                 @tester.international_home_work_phone_number)
  end

  def test_country_code
    10.times do
      assert_match(/(\+|00)33/, @tester.country_code)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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