Sha256: 9cbc844fe534efb14dbff732f171411066726e982ed340aebe1ff076edc27932

Contents?: true

Size: 630 Bytes

Versions: 8

Compression:

Stored size: 630 Bytes

Contents

require 'helper'

class TestFakerIdentification < Test::Unit::TestCase
  def setup
    @tester = Faker::Identification
  end

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

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

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ffaker-1.21.0 test/test_identification.rb
ffaker-1.20.0 test/test_identification.rb
ffaker-1.19.0 test/test_identification.rb
ffaker-1.18.0 test/test_identification.rb
ffaker-1.17.0 test/test_identification.rb
ffaker-1.16.2 test/test_identification.rb
ffaker-1.16.1 test/test_identification.rb
ffaker-1.16.0 test/test_identification.rb