validates_zipcode 0.0.6 → 0.0.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d310c9cbfd785c952d2daf6b683f224e6ade763e
|
4
|
+
data.tar.gz: 17485d2b67e7ff6ee5ecaa9b7fcbb746445ebae4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c40cc987d5e497c36369d8268ec115b0cf93172b1d5137bd054e30ae2202d268ff10ab525b765f11c0c6eb410d152776c95c795d590891f8fb3abd97245d34b
|
7
|
+
data.tar.gz: fa7f25b102a97c394fa2543d4b624510850b5d56b20fc3d25de13faa4f3a15a0955ad10ad85566a1d38281e68ae52326d50bb8baaf09fbd9c525076142688996
|
@@ -100,13 +100,13 @@ describe ValidatesZipcode, '#validate_each' do
|
|
100
100
|
record = build_record('21000', 'RS')
|
101
101
|
zipcode_should_be_valid(record)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
it 'does not validate with an invalid zipcode' do
|
105
105
|
record = build_record('2100', 'RS')
|
106
106
|
zipcode_should_be_invalid(record)
|
107
107
|
end
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
context "unknown country" do
|
111
111
|
it 'does not add errors with a any zipcode' do
|
112
112
|
record = build_record('A1J2Z9', 'ZZ')
|
@@ -119,7 +119,7 @@ describe ValidatesZipcode, '#validate_each' do
|
|
119
119
|
record = build_record('LT-0110', 'LT')
|
120
120
|
zipcode_should_be_valid(record)
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
it 'does not validate with an invalid zipcode' do
|
124
124
|
record = build_record('21006', 'LT')
|
125
125
|
zipcode_should_be_invalid(record)
|
@@ -131,13 +131,27 @@ describe ValidatesZipcode, '#validate_each' do
|
|
131
131
|
record = build_record('MD2001', 'MD')
|
132
132
|
zipcode_should_be_valid(record)
|
133
133
|
end
|
134
|
-
|
134
|
+
|
135
135
|
it 'does not validate with an invalid zipcode' do
|
136
136
|
record = build_record('MD-2100', 'MD')
|
137
137
|
zipcode_should_be_invalid(record)
|
138
138
|
end
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
|
+
context 'Portugal' do
|
142
|
+
it 'validates with a valid zipcode' do
|
143
|
+
['4500', '4500-250'].each do |zipcode|
|
144
|
+
record = build_record(zipcode, 'PT')
|
145
|
+
zipcode_should_be_valid(record)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'does not validate with an invalid zipcode' do
|
150
|
+
record = build_record('4500-2500', 'PT')
|
151
|
+
zipcode_should_be_invalid(record)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
141
155
|
def zipcode_should_be_valid(record)
|
142
156
|
ValidatesZipcode::Validator.new(attributes: :zipcode).validate(record)
|
143
157
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Gil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|