Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/locales/en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ en-GB:
- Northern Ireland
default_country_code:
- GB
id_number:
valid: '/[A-CEGHJ-NOPR-TW-Z][ACEHJLMOPRSW][0-9]{6}[ABCD]/'
invalid: '/(BG|GB|NK|KN|TN|NT|ZZ)[0-9]{6}[E-Z]{1}/'
internet:
domain_suffix:
- co.uk
Expand Down
14 changes: 14 additions & 0 deletions test/test_en_gb_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,18 @@ def test_en_gb_postcode_outcode_is_valid
assert_match(/^[A-PR-UWYZ][A-HK-Y0-9]/, outcode)
assert_match(/\w{1,2}\d{1,2}|\w\d[ABCDEFGHJKPSTUW]|\w\w\d[ABEHMNPRVWXY]/, outcode)
end

def test_en_gb_id_number_valid_is_valid
id_code = Faker::IdNumber.valid

assert_equal(9, id_code.length)
assert_match(/^[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z][0-9]{6}[A-DFM]$/, id_code)
end

def test_en_gb_id_number_invalid_is_invalid
id_code = Faker::IdNumber.invalid

assert_equal(9, id_code.length)
assert_not_match(/^[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z][0-9]{6}[A-DFM]$/, id_code)
end
end