From 68258d35d1a03475e51538b17ca4596c73a8389a Mon Sep 17 00:00:00 2001 From: Daniel Pepper Date: Sat, 3 Oct 2026 22:02:24 -0700 Subject: [PATCH] Run the Naruto and Indian GST tests Both were named text_ instead of test_, so neither has ever run: - text_faker_naruto.rb is outside the test/**/test*.rb glob (since cb72197c). - TestFakerCompany#text_indian_gst_number isn't picked up by Test::Unit (since 205bc521). Renaming the GST test exposed two problems it would have caught: - its regex only allowed state codes 00-37, while indian_gst_number generates 02-38 and 98, as documented; - ~10% of generated numbers were 14 characters: `int(length: 4, ranges: [0..9999])` ignores length when ranges are given, so values below 1000 weren't zero-padded. Generate 4 digits instead. Co-Authored-By: Claude Opus 5.5 --- lib/faker/default/company.rb | 2 +- test/faker/default/test_faker_company.rb | 4 ++-- .../{text_faker_naruto.rb => test_faker_naruto.rb} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename test/faker/japanese_media/{text_faker_naruto.rb => test_faker_naruto.rb} (100%) diff --git a/lib/faker/default/company.rb b/lib/faker/default/company.rb index e694f9802f..a31c20991b 100644 --- a/lib/faker/default/company.rb +++ b/lib/faker/default/company.rb @@ -496,7 +496,7 @@ def indian_gst_number(state_code: nil) g_.letter(length: 3, ranges: ['A'..'Z']) g_.letter(length: 1, ranges: [%w[A B C F G H L J P T K]]) g_.letter(length: 1, ranges: ['A'..'Z']) - g_.int(length: 4, ranges: [0..9999]) + g_.int(length: 4) g_.letter(length: 1, ranges: ['A'..'Z']) end diff --git a/test/faker/default/test_faker_company.rb b/test/faker/default/test_faker_company.rb index a6e1a6846e..26f6d69282 100644 --- a/test/faker/default/test_faker_company.rb +++ b/test/faker/default/test_faker_company.rb @@ -250,8 +250,8 @@ def test_spanish_b_algorithm assert_equal(3, @tester.send(:spanish_b_algorithm, 6)) end - def text_indian_gst_number - assert_match(/^([0-2][0-9]|3[0-7])[A-Z]{3}[ABCFGHLJPTK][A-Z]\d{4}[A-Z][A-Z0-9]Z[A-Z0-9]$/i, @tester.indian_gst_number) + def test_indian_gst_number + assert_match(/^(0[2-9]|[12][0-9]|3[0-8]|98)[A-Z]{3}[ABCFGHLJPTK][A-Z]\d{4}[A-Z][A-Z0-9]Z[A-Z0-9]$/i, @tester.indian_gst_number) end def test_state_code_in_indian_gst_number diff --git a/test/faker/japanese_media/text_faker_naruto.rb b/test/faker/japanese_media/test_faker_naruto.rb similarity index 100% rename from test/faker/japanese_media/text_faker_naruto.rb rename to test/faker/japanese_media/test_faker_naruto.rb