Sha256: 9f51d345f5add2bc1d6e1393c9e29b9d11b9ec30ec67afe0f2af4e83f9e9112c

Contents?: true

Size: 893 Bytes

Versions: 6

Compression:

Stored size: 893 Bytes

Contents

# encoding: utf-8

require 'helper'

# Author Guapolo <github.com/guapolo>
class TestIdentificationMX < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFaker::IdentificationMX,
    :rfc_persona_moral, :rfc_persona_fisica, :curp
  )

  def test_rfc_persona_moral
    re = /\A[a-zñÑ&]{3}\d{2}[0-1][0-9][0-3][0-9][a-z0-9]{3}\z/i
    assert_match(re, FFaker::IdentificationMX.rfc_persona_moral)
  end

  def test_rfc_persona_fisica
    re = /\A[a-zñÑ]{4}\d{2}[0-1][0-9][0-3][0-9][a-z0-9]{3}\z/i
    assert_match(re, FFaker::IdentificationMX.rfc_persona_fisica)
  end

  def test_curp
    or_curp_states_abbr = FFaker::IdentificationMX::ESTADOS_CURP.join('|')
    re = /\A[a-z][aeioux][a-z]{2}\d{2}[0-1]\d[0-3]\d[hm](?:#{or_curp_states_abbr})[bcdfghjklmnñpqrstvwxyz]{3}[0-9a-z]\d\z/ui
    assert_match(re, FFaker::IdentificationMX.curp)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ffaker-2.11.0 test/test_identification_es_mx.rb
ffaker-2.10.0 test/test_identification_es_mx.rb
ffaker-2.9.0 test/test_identification_es_mx.rb
ffaker-2.8.1 test/test_identification_es_mx.rb
ffaker-2.8.0 test/test_identification_es_mx.rb
ffaker-2.7.0 test/test_identification_es_mx.rb