Sha256: 1ae6b635478e50756e2f4928689834f242a5f209cdd0d38b383810846c72c646

Contents?: true

Size: 644 Bytes

Versions: 7

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

require 'helper'

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

  assert_methods_are_deterministic(FFaker::SSN, :ssn)

  def setup
    @actual_ssn = FFaker::SSN.ssn
  end

  def test_ssn_format
    assert_no_match(/\A666/, @actual_ssn)
    assert_match(/\A[0-8]\d{2}-\d{2}-\d{4}\Z/, @actual_ssn)
  end

  def test_ssn_groups_non_zero
    first_group, second_group, third_group = @actual_ssn.split('-')
    with_all_zeros = /\A0+\Z/

    assert_no_match(with_all_zeros, first_group)
    assert_no_match(with_all_zeros, second_group)
    assert_no_match(with_all_zeros, third_group)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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