validates_zipcode 0.3.0 → 0.3.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 +4 -0
- data/README.md +8 -0
- data/gemfiles/rails_4.2.gemfile.lock +1 -1
- data/gemfiles/rails_5.2.gemfile.lock +1 -1
- data/gemfiles/rails_6.0.gemfile.lock +1 -1
- data/gemfiles/rails_edge.gemfile.lock +1 -1
- data/lib/validates_zipcode/cldr_regex_collection.rb +1 -1
- data/lib/validates_zipcode/version.rb +1 -1
- data/spec/validates_zipcode_spec.rb +13 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad8c2f2c935a1571e8824200d9494c7d8d95ed6292eec99ddd135b8df5389f11
|
4
|
+
data.tar.gz: ad38314b05f03aac01b7ef9800e135eb99afe70dc03610609fb9aa67b5c26a88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34b5cf552795e382cf3a17f60898a4124bac5c4bc643f7c8996bbd2df9b442f62f8bae4ccb024f5332dd26698bfd3413f3f1d8b930a68225e388d17497c38ddb
|
7
|
+
data.tar.gz: c1cdd89cccb0966f28c1dd27c166097529873ac0a5662ebbf11f15f18a1d04ded857857a2ef858b88403b20988fa6f160d89a2409723ab82b8b29f4ff6866295
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -41,6 +41,8 @@ validates :zipcode, zipcode: { country_code: :es }
|
|
41
41
|
validates :zipcode, zipcode: { country_code_attribute: :my_country_code_column }
|
42
42
|
```
|
43
43
|
|
44
|
+
#### Error Messaging
|
45
|
+
|
44
46
|
If you need to localize the error message, just add this to your I18n locale file:
|
45
47
|
|
46
48
|
```yaml
|
@@ -49,6 +51,12 @@ errors:
|
|
49
51
|
invalid_zipcode: Your zipcode error message.
|
50
52
|
```
|
51
53
|
|
54
|
+
You can override this on a per-model basis by passing in a ``:message`` key with the validation:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
validates :zipcode, zipcode: { message: 'Your per-model zipcode error message.' }
|
58
|
+
```
|
59
|
+
|
52
60
|
### Without ActiveModel::Validations
|
53
61
|
|
54
62
|
```ruby
|
@@ -201,6 +201,19 @@ describe ValidatesZipcode, '#validate_each' do
|
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
+
context 'Netherlands' do
|
205
|
+
it 'does not add errors with a valid zipcode' do
|
206
|
+
record = build_record('1001 AA', 'NL')
|
207
|
+
zipcode_should_be_valid(record)
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'adds errors with an invalid Zipcode' do
|
211
|
+
['0100 AA', '1001 SS', 'invalid_zip'].each do |zipcode|
|
212
|
+
record = build_record(zipcode, 'NL')
|
213
|
+
zipcode_should_be_invalid(record, zipcode)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
204
217
|
context 'Panama' do
|
205
218
|
it 'validates with a valid zipcode' do
|
206
219
|
%w[0800 6369].each do |zipcode|
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Gil
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -153,7 +153,7 @@ homepage: http://github.com/dgilperez/validates_zipcode
|
|
153
153
|
licenses:
|
154
154
|
- MIT
|
155
155
|
metadata: {}
|
156
|
-
post_install_message:
|
156
|
+
post_install_message:
|
157
157
|
rdoc_options: []
|
158
158
|
require_paths:
|
159
159
|
- lib
|
@@ -168,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
rubygems_version: 3.0.
|
172
|
-
signing_key:
|
171
|
+
rubygems_version: 3.0.8
|
172
|
+
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Localizable zipcode validation for Rails.
|
175
175
|
test_files:
|