Skip to content

Commit 5fcd9e9

Browse files
authored
test: fix flaky test on Faker::IdNumber (#3126)
1 parent c29e8ae commit 5fcd9e9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/faker/default/test_faker_id_number.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_invalid_south_african_id_number
6666
sample = @tester.invalid_south_african_id_number
6767

6868
assert_raises Date::Error do
69-
Date.parse(south_african_id_number_to_date_of_birth_string(sample))
69+
Date.parse(sample[0..5])
7070
end
7171
end
7272

@@ -276,15 +276,12 @@ def test_danish_id_number_invalid_gender
276276

277277
private
278278

279-
def south_african_id_number_to_date_of_birth_string(sample)
280-
"19#{sample[0..1]}/#{sample[2..3]}/#{sample[4..5]}}"
281-
end
282-
283279
def assert_valid_south_african_id_number(sample)
284280
assert_equal 13, sample.length
285281
assert_match(/^\d{13}$/, sample)
286282
assert_include Faker::IdNumber::ZA_CITIZENSHIP_DIGITS, sample[10]
287283
assert_equal Faker::IdNumber::ZA_RACE_DIGIT, sample[11]
288-
assert Date.parse(south_african_id_number_to_date_of_birth_string(sample))
284+
285+
assert Date.parse(sample[0..5])
289286
end
290287
end

0 commit comments

Comments
 (0)