Sha256: 33f017c42f266a8748accdbe36f05c7e785a4fcd8475185cf4a4c096a8b5395c

Contents?: true

Size: 657 Bytes

Versions: 9

Compression:

Stored size: 657 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

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

  assert_methods_are_deterministic(FFakerTW::SSN, :ssn)

  def setup
    @actual_ssn = FFakerTW::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

9 entries across 9 versions & 1 rubygems

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