Sha256: 1e08c4f39251e99f25780723f1ca0096ea1c64241d8f962a778e7c71a5b31fa4

Contents?: true

Size: 869 Bytes

Versions: 10

Compression:

Stored size: 869 Bytes

Contents

# encoding: utf-8

require 'helper'

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

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

  def setup
    @tester = FFaker::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 = /\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

10 entries across 10 versions & 1 rubygems

Version Path
ffaker-2.11.0 test/test_identification.rb
ffaker-2.10.0 test/test_identification.rb
ffaker-2.9.0 test/test_identification.rb
ffaker-2.8.1 test/test_identification.rb
ffaker-2.8.0 test/test_identification.rb
ffaker-2.7.0 test/test_identification.rb
ffaker-2.6.0 test/test_identification.rb
ffaker-2.5.0 test/test_identification.rb
ffaker-2.4.0 test/test_identification.rb
ffaker-2.3.0 test/test_identification.rb