validates_zipcode 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/validates_zipcode/cldr_regex_collection.rb +2 -2
- data/lib/validates_zipcode/version.rb +1 -1
- data/spec/spec_helper.rb +17 -7
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ba868b72c89f1dfbe11442ad8bc8d96f4a00c03cbcb41e7f0fb03343f73bcce8
|
|
4
|
+
data.tar.gz: d5494024cda83f6e81ea11019f2e0b06e5ec8fcde5d4e15c380af8b748dd13fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcce5f5f3da925efa15747fdae9272644bf3f2e6764a7682e418ca94eeb506116df37f3580f32484640625c2acaa0bfaa850dbe7187fbe8142a66bd368eae8b4
|
|
7
|
+
data.tar.gz: 1afb2ee765e1eadbb8dc49a313a0bb4b7af2eb749aa0048141d106934fc9b2508e665b4c2557a59fa0a6dae5810dba30dba51f55ed06a20c68101a6bd19546a5
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.6.1
|
|
8
|
+
|
|
9
|
+
Backport of the postcode fixes in 0.7.0 for apps that cannot move to Ruby >= 3.3 and Rails >= 8.0 yet. Requirements are unchanged from 0.6.0.
|
|
10
|
+
|
|
11
|
+
- Accept Nigeria's (NG) 11-character digital postcode, such as `EK-01-A03-FK-01`, alongside the six-digit code. NIPOST launched it in October 2026. Thanks to ~ @Adeniyikayodee
|
|
12
|
+
- Fix the Moldova (MD) postcode pattern: accept the canonical `MD-####` form and bare 4-digit codes, and reject non-`MD` letter prefixes. The previous pattern required any two letters and rejected the hyphenated form — fixes #73
|
|
13
|
+
|
|
7
14
|
## 0.6.0
|
|
8
15
|
|
|
9
16
|
**Heads up:** This release changes the behaviour of `ValidatesZipcode.valid?` when an unknown or malformed country code is passed. Previously, passing a country code not recognised by the gem (e.g. `'UKXXXXX'`) would return `true` — no regex to match against meant no failure. It will now return `false`.
|
|
@@ -77,7 +77,7 @@ module ValidatesZipcode
|
|
|
77
77
|
MA: /\A\d{5}\z/,
|
|
78
78
|
NZ: /\A\d{4}\z/,
|
|
79
79
|
NI: /\A\d{5}\z/,
|
|
80
|
-
NG: /\A\d{6}\z
|
|
80
|
+
NG: /\A(\d{6}|[A-Z]{2}[- ]?(0[1-9]|[1-9]\d)[- ]?[A-Z0-9]{3}[- ]?[A-Z]{2}[- ]?(0[1-9]|[1-9]\d))\z/i,
|
|
81
81
|
OM: /\A(PC )?\d{3}\z/i,
|
|
82
82
|
PK: /\A\d{5}\z/,
|
|
83
83
|
PY: /\A(\d{4}|\d{6})\z/,
|
|
@@ -203,7 +203,7 @@ module ValidatesZipcode
|
|
|
203
203
|
LT: /\A(LT[\- ]?)?\d{5}\z/i,
|
|
204
204
|
LC: /\A([A-Z\d\s]){3,}\z/i,
|
|
205
205
|
MC: /\A\d{5}\z/,
|
|
206
|
-
MD: /\A(
|
|
206
|
+
MD: /\A(MD[- ]?)?\d{4}\z/i,
|
|
207
207
|
ME: /\A([A-Z\d\s]){3,}\z/i,
|
|
208
208
|
MH: /\A\d{5}\z/,
|
|
209
209
|
MR: /\A([A-Z\d\s]){3,}\z/i,
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1065,11 +1065,15 @@ TEST_DATA = {
|
|
|
1065
1065
|
]
|
|
1066
1066
|
},
|
|
1067
1067
|
NG: {
|
|
1068
|
-
valid:
|
|
1069
|
-
071134
|
|
1070
|
-
025663
|
|
1071
|
-
662612
|
|
1072
|
-
071135
|
|
1068
|
+
valid: [
|
|
1069
|
+
'071134',
|
|
1070
|
+
'025663',
|
|
1071
|
+
'662612',
|
|
1072
|
+
'071135',
|
|
1073
|
+
'EK-01-A03-FK-01',
|
|
1074
|
+
'EK 01 A03 FK 01',
|
|
1075
|
+
'EK01A03FK01',
|
|
1076
|
+
'ek01a03fk01'
|
|
1073
1077
|
],
|
|
1074
1078
|
invalid: [
|
|
1075
1079
|
nil,
|
|
@@ -1077,7 +1081,10 @@ TEST_DATA = {
|
|
|
1077
1081
|
'invalid_zip',
|
|
1078
1082
|
'12345',
|
|
1079
1083
|
'123456-123456',
|
|
1080
|
-
'D0D0D0'
|
|
1084
|
+
'D0D0D0',
|
|
1085
|
+
'EK-00-A03-FK-01',
|
|
1086
|
+
'EK-01-A03-FK-00',
|
|
1087
|
+
'EK-01-A03-FK-011'
|
|
1081
1088
|
]
|
|
1082
1089
|
},
|
|
1083
1090
|
OM: {
|
|
@@ -2839,13 +2846,16 @@ TEST_DATA = {
|
|
|
2839
2846
|
},
|
|
2840
2847
|
MD: {
|
|
2841
2848
|
valid: %w[
|
|
2849
|
+
2001
|
|
2842
2850
|
MD2001
|
|
2851
|
+
MD-2001
|
|
2843
2852
|
],
|
|
2844
2853
|
invalid: [
|
|
2845
2854
|
nil,
|
|
2846
2855
|
'',
|
|
2847
2856
|
'invalid_zip',
|
|
2848
|
-
'
|
|
2857
|
+
'XY2021',
|
|
2858
|
+
'MD-202'
|
|
2849
2859
|
]
|
|
2850
2860
|
},
|
|
2851
2861
|
ME: {
|