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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da88fce714c50ac27abe1f64ce191dd48e274627db7a1499fec7a303a717ea08
4
- data.tar.gz: 4ffc0f1f1435f9a16a41fe99e2124c2694cd014d46a98751fa1fc0fc203222c9
3
+ metadata.gz: ad8c2f2c935a1571e8824200d9494c7d8d95ed6292eec99ddd135b8df5389f11
4
+ data.tar.gz: ad38314b05f03aac01b7ef9800e135eb99afe70dc03610609fb9aa67b5c26a88
5
5
  SHA512:
6
- metadata.gz: de68bd2086e4ff55b2da3848ae25f1d051dd066fb1afcdc517c8a191382ec7b1379256724a537ab7b7d4e129b2915896c72d6a73c4c2c31c80b14d9280599102
7
- data.tar.gz: d1d76356f263fcfda47ff0c6bb33e55df6a1fd2ecdc8c87d7c0d976ccd54362e9c49a9a23722834ebd52dbf87e6ad89fdab4619e3cc96eddaa7c36935331cd2b
6
+ metadata.gz: 34b5cf552795e382cf3a17f60898a4124bac5c4bc643f7c8996bbd2df9b442f62f8bae4ccb024f5332dd26698bfd3413f3f1d8b930a68225e388d17497c38ddb
7
+ data.tar.gz: c1cdd89cccb0966f28c1dd27c166097529873ac0a5662ebbf11f15f18a1d04ded857857a2ef858b88403b20988fa6f160d89a2409723ab82b8b29f4ff6866295
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.3.1
6
+
7
+ - Removes forbidden combinations in the Netherlands ~ @gerard76
8
+
5
9
  ## 0.3.0
6
10
 
7
11
  - Adds zipcode formatting feature ~ @aiomaster
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- validates_zipcode (0.3.0)
4
+ validates_zipcode (0.3.1)
5
5
  activemodel (>= 4.2.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- validates_zipcode (0.3.0)
4
+ validates_zipcode (0.3.1)
5
5
  activemodel (>= 4.2.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- validates_zipcode (0.3.0)
4
+ validates_zipcode (0.3.1)
5
5
  activemodel (>= 4.2.0)
6
6
 
7
7
  GEM
@@ -14,7 +14,7 @@ GIT
14
14
  PATH
15
15
  remote: ..
16
16
  specs:
17
- validates_zipcode (0.3.0)
17
+ validates_zipcode (0.3.1)
18
18
  activemodel (>= 4.2.0)
19
19
 
20
20
  GEM
@@ -21,7 +21,7 @@ module ValidatesZipcode
21
21
  CH: /\A\d{4}\z/,
22
22
  AT: /\A\d{4}\z/,
23
23
  ES: /\A\d{5}\z/,
24
- NL: /\A\d{4}[ ]?[A-Z]{2}\z/,
24
+ NL: /\A[1-9]\d{3}[ ]?(?!SA|SD|SS)[A-Z]{2}\z/,
25
25
  BE: /\A\d{4}\z/,
26
26
  DK: /\A\d{4}\z/,
27
27
  NO: /\A\d{4}\z/,
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ValidatesZipcode
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
@@ -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.0
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-05-24 00:00:00.000000000 Z
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.6
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: