Sha256: a5267771d64f9db1e5f1279115c1aa9da2aa815238f28a53c1d2ce0addb9b8b5

Contents?: true

Size: 895 Bytes

Versions: 9

Compression:

Stored size: 895 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

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

  assert_methods_are_deterministic(
    FFakerTW::Identification,
    :drivers_license, :ssn, :gender, :ethnicity
  )

  def setup
    @tester = FFakerTW::Identification
  end

  def test_drivers_license
    ###-###-##-###-#
    drivers_license_regex = /\A[A-Z]\d{3}-\d{3}-\d{2}-\d{3}-\d{1}\z/
    assert_match(drivers_license_regex, @tester.drivers_license)
  end

  def test_ssn
    assert_match(/\A\d{3}-\d{2}-\d{4}\z/, @tester.ssn)
  end

  def test_gender
    assert_match(/\A(Male|Female)\z/, @tester.gender)
  end

  def test_ethnicity
    ethnicity_regex = %r{\A(African American|Asian/Pacific Islander|Caucasian|Hispanic|Native American|Multiracial|Other|Prefer not to respond)\z}
    assert_match(ethnicity_regex, @tester.ethnicity)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffakerTW-1.8.0 test/test_identification.rb
ffakerTW-1.7.0 test/test_identification.rb
ffakerTW-1.6.0 test/test_identification.rb
ffakerTW-1.5.0 test/test_identification.rb
ffakerTW-1.4.0 test/test_identification.rb
ffakerTW-1.3.0 test/test_identification.rb
ffakerTW-1.2.0 test/test_identification.rb
ffakerTW-1.1.0 test/test_identification.rb
ffakerTW-0.1.0 test/test_identification.rb