validates_zipcode 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/validates_zipcode/cldr_regex_collection.rb +2 -1
- data/lib/validates_zipcode/version.rb +1 -1
- data/spec/validates_zipcode_spec.rb +30 -0
- data/validates_zipcode.gemspec +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5fdc2780e2e8f930d6aff37b66ed9b0ec8af83c
|
4
|
+
data.tar.gz: 221850652036835e4621013b093208d40c99d5d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98986db28ff6e50982eb22604ac36e74a10e86226c515f67322d9a60c942123ab4b8145dad3fb583293831dc277003364fb688639ef16850d29e3a45d4410c10
|
7
|
+
data.tar.gz: 9993eddae750c13791b4bc6f23a834009c4422ae8744b49d3ed3650b9defaa970264b7b6d83bb0c29bb247d71cdc5aea6007e00d1cb1b06c0fd1c9dd339a434c
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 0.0.13
|
5
|
+
|
6
|
+
- Support for new Korea postal codes ~ @adlersantos
|
7
|
+
|
8
|
+
## 0.0.12
|
9
|
+
|
10
|
+
- Sweden whitespace made optional ~ @radubatori
|
11
|
+
|
4
12
|
## 0.0.11
|
5
13
|
|
6
14
|
- Fix Brazil zipcode ~ @pedrosfdcarneiro
|
@@ -9,6 +9,7 @@ module ValidatesZipcode
|
|
9
9
|
GG: /\AGY\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}\z/,
|
10
10
|
IM: /\AIM\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}\z/,
|
11
11
|
US: /\A\d{5}([ \-](?:\d{4}|\d{6}))?\z/,
|
12
|
+
IE: /\A([AC-FHKNPRTV-Y]\d{2}|D6W)[0-9AC-FHKNPRTV-Y]{4}\z/,
|
12
13
|
CA: /\A[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ ]?\d[ABCEGHJ-NPRSTV-Z]\d\z/,
|
13
14
|
DE: /\A\d{5}\z/,
|
14
15
|
AU: /\A\d{4}\z/,
|
@@ -22,7 +23,7 @@ module ValidatesZipcode
|
|
22
23
|
NO: /\A\d{4}\z/,
|
23
24
|
FI: /\A\d{5}\z/,
|
24
25
|
AX: /\A22\d{3}\z/,
|
25
|
-
KR: /\A\d{3}[\-]\d{3}\z/,
|
26
|
+
KR: /\A(\d{5}|\d{3}[\-]\d{3})\z/,
|
26
27
|
CN: /\A\d{6}\z/,
|
27
28
|
SG: /\A\d{6}\z/,
|
28
29
|
DZ: /\A\d{5}\z/,
|
@@ -33,6 +33,22 @@ describe ValidatesZipcode, '#validate_each' do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
context "Ireland" do
|
37
|
+
it 'does not add errors with a valid postcode' do
|
38
|
+
['D6W1234', 'A230984', 'D00AV92', 'Y631FHK', 'A000000', 'D44N4X4'].each do |zipcode|
|
39
|
+
record = build_record(zipcode, 'IE')
|
40
|
+
zipcode_should_be_valid(record)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'adds errors with an invalid Zipcode' do
|
45
|
+
['1234', '12345-12345', 'invalid_zip'].each do |zipcode|
|
46
|
+
record = build_record(zipcode, 'IE')
|
47
|
+
zipcode_should_be_invalid(record, zipcode)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
36
52
|
context "Argentina" do
|
37
53
|
it 'does not add errors with a valid zipcode' do
|
38
54
|
record = build_record('C1424CHN', "AR")
|
@@ -166,6 +182,20 @@ describe ValidatesZipcode, '#validate_each' do
|
|
166
182
|
end
|
167
183
|
end
|
168
184
|
|
185
|
+
context 'South Korea' do
|
186
|
+
it 'validates with a valid zipcode' do
|
187
|
+
['72315', '723-150', '11011', '110-110'].each do |zipcode|
|
188
|
+
record = build_record(zipcode, 'KR')
|
189
|
+
zipcode_should_be_valid(record)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'does not validate with an invalid zipcode' do
|
194
|
+
record = build_record('723155', 'KR')
|
195
|
+
zipcode_should_be_invalid(record)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
169
199
|
context 'Czech' do
|
170
200
|
it 'validates with a valid zipcode' do
|
171
201
|
['12000', '721 00'].each do |zipcode|
|
data/validates_zipcode.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.required_ruby_version = '>= 1.9.3'
|
22
22
|
|
23
|
-
s.add_dependency 'activemodel', '>= 3.2.0'
|
23
|
+
s.add_dependency 'activemodel', '>= 3.2.0', '< 5.0'
|
24
24
|
|
25
25
|
s.add_development_dependency "bundler", "~> 1.6"
|
26
26
|
s.add_development_dependency "rake"
|
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.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Gil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.2.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 3.2.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|