Sha256: fbd0cfd5cc0702bf90466ad65db04f071bedb2ece2b52745db9d5641da7c7602

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'helper'

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

  assert_methods_are_deterministic(
    FFaker::PhoneNumberSN,
    :mobile_phone_prefix, :homework_phone_prefix, :mobile_number, :phone_number,
    :homework_number, :short_phone_number
  )

  def setup
    @tester = FFaker::PhoneNumberSN
  end

  def test_mobile_phone_prefix
    assert FFaker::PhoneNumberSN::MOBILE_OPERATORS_PREFIX.include?(@tester.mobile_phone_prefix)
  end

  def test_homework_phone_prefix
    assert FFaker::PhoneNumberSN::HOME_WORK_OPERATORS_PREFIX.include?(@tester.homework_phone_prefix)
  end

  def test_short_phone_number
    assert_match(/\d{3}-\d{2}-\d{2}/, FFaker::PhoneNumberSN.short_phone_number)
  end

  def test_mobile_phone_number
    assert_match(/(70|76|77)-\d{3}-\d{2}-\d{2}/, FFaker::PhoneNumberSN.mobile_number)
  end

  def test_phone_number
    assert_match(/(33|70|76|77)-\d{3}-\d{2}-\d{2}/, FFaker::PhoneNumberSN.phone_number)
  end

  def test_homework_phone_number
    assert_match(/(33)-(8|9)\d{2}-\d{2}-\d{2}/, FFaker::PhoneNumberSN.homework_number)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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