validates_zipcode 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6319e7e849e15894588798afea63010d680ad791
4
- data.tar.gz: 57009cf1500517c52b057a86d455261cfa85b093
3
+ metadata.gz: 99f0626521efd52efa07619ed05806a56f2ffafb
4
+ data.tar.gz: e3cc9c7095befadcb691db961c928436a82f020a
5
5
  SHA512:
6
- metadata.gz: f2ca3c88022cac9e4073f7a865db67e8ddf056ead3e6ae1fd28601655f7773925ed6b2518c5b9b7c60daa3de644b06633c1f825d6e5685ba4f0d8cf178a814cf
7
- data.tar.gz: d88c9084f22ae5e3f36baeed251c06f6c23141266172b8a31f915ff64851521ceaca4cf5d2f6953f0b5ee1b66be9982744bc617969f59240ed44dc4f025c94f2
6
+ metadata.gz: 502ce7e4cc3ce8c1907c3e14c2722e9946a5cbf68f3dd80f825099b3030b73a67ea9064eb612d7da6a9e8c43c62c1e7a06933ceb8a02eb059b2d8c2fa999957b
7
+ data.tar.gz: 68a49d8d2f215dfdcfbbc3c9659516e7dfc022c62fe5189d221f0a7644af812139aa7279cf79f6cf497c16ef3a42c40f2a363d4d0d2e82eb7cc61609707fd3ad
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.0.20
6
+
7
+ - Merge UK and GB regex, using official regex provided by gob.uk ~ @Onumis @dgilperez
8
+
5
9
  ## 0.0.19
6
10
 
7
11
  - Fixes JP and IE formats, thanks to ~ @timokleemann
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: ../
2
+ remote: ..
3
3
  specs:
4
- validates_zipcode (0.0.19)
4
+ validates_zipcode (0.0.20)
5
5
  activemodel (>= 3.2.0)
6
6
 
7
7
  GEM
@@ -49,4 +49,4 @@ DEPENDENCIES
49
49
  validates_zipcode!
50
50
 
51
51
  BUNDLED WITH
52
- 1.13.6
52
+ 1.14.6
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: ../
2
+ remote: ..
3
3
  specs:
4
- validates_zipcode (0.0.19)
4
+ validates_zipcode (0.0.20)
5
5
  activemodel (>= 3.2.0)
6
6
 
7
7
  GEM
@@ -55,4 +55,4 @@ DEPENDENCIES
55
55
  validates_zipcode!
56
56
 
57
57
  BUNDLED WITH
58
- 1.13.6
58
+ 1.14.6
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: ../
2
+ remote: ..
3
3
  specs:
4
- validates_zipcode (0.0.19)
4
+ validates_zipcode (0.0.20)
5
5
  activemodel (>= 3.2.0)
6
6
 
7
7
  GEM
@@ -56,4 +56,4 @@ DEPENDENCIES
56
56
  validates_zipcode!
57
57
 
58
58
  BUNDLED WITH
59
- 1.13.6
59
+ 1.16.1
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: ../
2
+ remote: ..
3
3
  specs:
4
- validates_zipcode (0.0.19)
4
+ validates_zipcode (0.0.20)
5
5
  activemodel (>= 3.2.0)
6
6
 
7
7
  GEM
@@ -56,4 +56,4 @@ DEPENDENCIES
56
56
  validates_zipcode!
57
57
 
58
58
  BUNDLED WITH
59
- 1.13.6
59
+ 1.16.1
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: ../
2
+ remote: ..
3
3
  specs:
4
- validates_zipcode (0.0.19)
4
+ validates_zipcode (0.0.20)
5
5
  activemodel (>= 3.2.0)
6
6
 
7
7
  GEM
@@ -53,4 +53,4 @@ DEPENDENCIES
53
53
  validates_zipcode!
54
54
 
55
55
  BUNDLED WITH
56
- 1.13.6
56
+ 1.16.1
@@ -5,7 +5,10 @@
5
5
  module ValidatesZipcode
6
6
  module CldrRegexpCollection
7
7
  ZIPCODES_REGEX = {
8
- GB: /\AGIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|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Z0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)\z/,
9
12
  JE: /\AJE\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}\z/,
10
13
  GG: /\AGY\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}\z/,
11
14
  IM: /\AIM\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}\z/,
@@ -230,7 +233,6 @@ module ValidatesZipcode
230
233
  TZ: /\A([a-zA-Z\d\s]){3,}\z/,
231
234
  TT: /\A\d{6}\z/,
232
235
  TW: /\A\d{3}\z/,
233
- UK: /\A([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)\z/,
234
236
  UG: /\A([a-zA-Z\d\s]){3,}\z/,
235
237
  UM: /\A([a-zA-Z\d\s]){3,}\z/,
236
238
  UY: /\A([a-zA-Z\d\s]){3,}\z/,
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ValidatesZipcode
3
- VERSION = '0.0.19'
3
+ VERSION = '0.0.20'
4
4
  end
@@ -263,6 +263,33 @@ describe ValidatesZipcode, '#validate_each' do
263
263
  end
264
264
  end
265
265
 
266
+ ['UK', 'GB'].each do |cc|
267
+ context cc do
268
+ it 'validates with a valid zipcode' do
269
+ [
270
+ 'ID1 1QD',
271
+ 'M32 0JG',
272
+ 'NE30 1DP',
273
+ 'OX49 5NU',
274
+ 'SW1A 2AA',
275
+ 'W1K 7DA',
276
+ 'id1 1qd',
277
+ 'Sw1A 2aA'
278
+ ].each do |zipcode|
279
+ record = build_record(zipcode, cc)
280
+ zipcode_should_be_valid(record)
281
+ end
282
+ end
283
+
284
+ it 'does not validate with an invalid zipcode' do
285
+ [nil, '', 'nope', 'id11qd', 'SW1A2AA'].each do |zipcode|
286
+ record = build_record(zipcode, cc)
287
+ zipcode_should_be_invalid(record, nil)
288
+ end
289
+ end
290
+ end
291
+ end
292
+
266
293
  context 'USA' do
267
294
  it 'does not add errors with a valid zipcode' do
268
295
  record = build_record('93108', 'US')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_zipcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Gil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-25 00:00:00.000000000 Z
11
+ date: 2018-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.6.7
144
+ rubygems_version: 2.6.12
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Localizable zipcode validation for Rails.