validates_zipcode 0.3.2 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -2
- data/.travis.yml +13 -6
- data/Appraisals +6 -2
- data/CHANGELOG.md +21 -0
- data/README.md +17 -0
- data/gemfiles/rails_4.2.gemfile +3 -4
- data/gemfiles/rails_4.2.gemfile.lock +2 -2
- data/gemfiles/rails_5.2.gemfile +3 -4
- data/gemfiles/rails_5.2.gemfile.lock +2 -2
- data/gemfiles/rails_6.1.gemfile +7 -0
- data/gemfiles/rails_6.1.gemfile.lock +85 -0
- data/gemfiles/rails_7.0.gemfile +7 -0
- data/gemfiles/rails_7.0.gemfile.lock +85 -0
- data/gemfiles/rails_edge.gemfile +3 -4
- data/gemfiles/rails_edge.gemfile.lock +2 -2
- data/lib/validates_zipcode/cldr_regex_collection.rb +95 -92
- data/lib/validates_zipcode/formatter.rb +14 -1
- data/lib/validates_zipcode/validator.rb +7 -5
- data/lib/validates_zipcode/version.rb +1 -1
- data/lib/validates_zipcode/zipcode.rb +11 -3
- data/spec/format_zipcode_spec.rb +1 -1
- data/spec/spec_helper.rb +3568 -0
- data/spec/validates_zipcode_spec.rb +42 -370
- metadata +7 -5
- data/gemfiles/rails_6.0.gemfile +0 -8
- data/gemfiles/rails_6.0.gemfile.lock +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df2a33cb45dafbda679e54e3030fc68c6ed9bd333f1b6333c62fd7f55d19e34a
|
4
|
+
data.tar.gz: 650da19b279aa781e6cfeb3452b9cef2f534bf8eb07a24b9d3335e803ed0c4e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96c289be91ec67e3bc2ae13627088b35720f61257449fd372b4dbf96decf90a95a5d24b0dff58d599632aee4f2af803f470a9352b94b2c0a0a815daec6b1197c
|
7
|
+
data.tar.gz: 4ec5b753940e0f7593249ad0090836ee778b170c5da70632069d1eceb14ec523236ced64ec221b13aaad0350e0537a82aa0c602436e9cf4706019b582670e050
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -12,7 +12,7 @@ require:
|
|
12
12
|
AllCops:
|
13
13
|
TargetRubyVersion: 2.4
|
14
14
|
|
15
|
-
TargetRailsVersion:
|
15
|
+
TargetRailsVersion: 5.2
|
16
16
|
|
17
17
|
# Include common Ruby source files.
|
18
18
|
Include:
|
@@ -862,7 +862,7 @@ Layout/DefEndAlignment:
|
|
862
862
|
|
863
863
|
##################### Rails ##################################
|
864
864
|
Rails:
|
865
|
-
Enabled:
|
865
|
+
Enabled: false
|
866
866
|
|
867
867
|
Rails/ActionFilter:
|
868
868
|
EnforcedStyle: action
|
data/.travis.yml
CHANGED
@@ -7,23 +7,26 @@ cache: bundler
|
|
7
7
|
bundler_args: --jobs 3 --retry 3
|
8
8
|
|
9
9
|
before_install:
|
10
|
-
-
|
11
|
-
-
|
10
|
+
- "travis_retry gem update --system"
|
11
|
+
- "travis_retry gem install bundler"
|
12
12
|
|
13
|
-
script:
|
13
|
+
script: "bundle exec rake"
|
14
14
|
|
15
15
|
rvm:
|
16
16
|
- 2.4.9
|
17
17
|
- 2.5.7
|
18
18
|
- 2.6.5
|
19
|
-
- 2.7.
|
19
|
+
- 2.7.2
|
20
|
+
- 3.0.0
|
21
|
+
- 3.1.2
|
20
22
|
- ruby-head
|
21
23
|
- truffleruby
|
22
24
|
|
23
25
|
gemfile:
|
24
26
|
- gemfiles/rails_4.2.gemfile
|
25
27
|
- gemfiles/rails_5.2.gemfile
|
26
|
-
- gemfiles/rails_6.
|
28
|
+
- gemfiles/rails_6.1.gemfile
|
29
|
+
- gemfiles/rails_7.0.gemfile
|
27
30
|
- gemfiles/rails_edge.gemfile
|
28
31
|
|
29
32
|
matrix:
|
@@ -32,6 +35,10 @@ matrix:
|
|
32
35
|
- rvm: ruby-head
|
33
36
|
exclude:
|
34
37
|
- rvm: 2.4.9
|
35
|
-
gemfile: gemfiles/rails_6.gemfile
|
38
|
+
gemfile: gemfiles/rails_6.1.gemfile
|
36
39
|
- rvm: 2.4.9
|
40
|
+
gemfile: gemfiles/rails_7.0.gemfile
|
41
|
+
- rvm: 2.4.9
|
42
|
+
gemfile: gemfiles/rails_edge.gemfile
|
43
|
+
- rvm: 3.0.0
|
37
44
|
gemfile: gemfiles/rails_edge.gemfile
|
data/Appraisals
CHANGED
@@ -8,8 +8,12 @@ appraise 'rails-5.2' do
|
|
8
8
|
gem 'activemodel', '~> 5.2.0'
|
9
9
|
end
|
10
10
|
|
11
|
-
appraise 'rails-6.
|
12
|
-
gem 'activemodel', '~>
|
11
|
+
appraise 'rails-6.1' do
|
12
|
+
gem 'activemodel', '~> 6.1.0'
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise 'rails-7.0' do
|
16
|
+
gem 'activemodel', '~> 7.0.0'
|
13
17
|
end
|
14
18
|
|
15
19
|
appraise 'rails_edge' do
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## 0.5.1
|
6
|
+
|
7
|
+
- Fixes Mongolia postal codes, thanks to ~ @lucasfcunha
|
8
|
+
|
9
|
+
## 0.5.0
|
10
|
+
|
11
|
+
- Pass `format: true` option to the `validates_zipcode` or the constructor to attempt for format a given code using the (uncomplete) list of formatters by country. This process will happen before the validation takes place, dealing with case sensitive formats and whitespace, amongst others. This option is false by default for backwards compatibility. ~ @chloe-meister
|
12
|
+
- Fixed unconsistent behaviour by which the `ValidatesZipcode.format` and `ValidatesZipcode::Formatter.new(..).format` where formatting an invalid code, the former, and raising a validity error, the latter. ~ @chloe-meister
|
13
|
+
|
14
|
+
## 0.4.0
|
15
|
+
|
16
|
+
**HEADS UP**: While I don't think this update would break any system for anyone, many formats where revisited to make them more loose or strict, potentially rendering your data invalid, particularly in edge cases or with data that was already incorrect in the first place and not flagges as such. I recommend you check your data with the new version in case these validations are critical to you. I am not releasing this as a 1.0 because there are no breaking changes in the API though. See PR #54 for more details.
|
17
|
+
|
18
|
+
- Many regexps where modified to include recent changes in postal services, fix issues, narrow down formats that where unnecessary broad, allow for some looser cases such as optional whitespaces and making many of them case insensitive and removing countries with no postal codes - See PR #54. Thanks to ~ @ojsdude with some help from @dgilperez
|
19
|
+
- Allow the gem to generate test data from the formatters. See README ~ @ojsdude
|
20
|
+
- Officially support Ruby 3 and Rails 6.1
|
21
|
+
|
22
|
+
## 0.3.3
|
23
|
+
|
24
|
+
- Fixes AR regex
|
25
|
+
|
5
26
|
## 0.3.2
|
6
27
|
|
7
28
|
- Adds formatter for CA ~ @devthiago
|
data/README.md
CHANGED
@@ -82,6 +82,23 @@ ValidatesZipcode.format('Sw1A 2aA', 'FR')
|
|
82
82
|
|
83
83
|
At the moment not every country is supported. See [lib/validates_zipcode/formatter.rb](lib/validates_zipcode/formatter.rb) to find all available countries.
|
84
84
|
|
85
|
+
### Test data
|
86
|
+
|
87
|
+
In order to generate test data, we suggest using the [regexp-examples gem](https://github.com/tom-lord/regexp-examples)
|
88
|
+
This dependency will allow you to create examples as follows:
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
require "regexp-examples"
|
92
|
+
|
93
|
+
ValidatesZipcode::CldrRegexpCollection::ZIPCODES_REGEX[:ES].examples
|
94
|
+
|
95
|
+
# => ["00000", "00001", "00002", "00003", ..., "44443", "44444"]
|
96
|
+
|
97
|
+
ValidatesZipcode::CldrRegexpCollection::ZIPCODES_REGEX[:ES].random_example
|
98
|
+
|
99
|
+
# => "27072"
|
100
|
+
```
|
101
|
+
|
85
102
|
## Contributing
|
86
103
|
|
87
104
|
1. Fork it
|
data/gemfiles/rails_4.2.gemfile
CHANGED
data/gemfiles/rails_5.2.gemfile
CHANGED
@@ -0,0 +1,85 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
validates_zipcode (0.5.1)
|
5
|
+
activemodel (>= 4.2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (6.1.3)
|
11
|
+
activesupport (= 6.1.3)
|
12
|
+
activesupport (6.1.3)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
|
+
appraisal (2.4.0)
|
19
|
+
bundler
|
20
|
+
rake
|
21
|
+
thor (>= 0.14.0)
|
22
|
+
ast (2.4.2)
|
23
|
+
concurrent-ruby (1.1.8)
|
24
|
+
diff-lcs (1.4.4)
|
25
|
+
i18n (1.8.9)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
minitest (5.14.4)
|
28
|
+
parallel (1.20.1)
|
29
|
+
parser (3.0.0.0)
|
30
|
+
ast (~> 2.4.1)
|
31
|
+
rack (2.2.3)
|
32
|
+
rainbow (3.0.0)
|
33
|
+
rake (13.0.3)
|
34
|
+
regexp_parser (2.1.1)
|
35
|
+
rexml (3.2.4)
|
36
|
+
rspec (3.10.0)
|
37
|
+
rspec-core (~> 3.10.0)
|
38
|
+
rspec-expectations (~> 3.10.0)
|
39
|
+
rspec-mocks (~> 3.10.0)
|
40
|
+
rspec-core (3.10.1)
|
41
|
+
rspec-support (~> 3.10.0)
|
42
|
+
rspec-expectations (3.10.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.10.0)
|
45
|
+
rspec-mocks (3.10.2)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.10.0)
|
48
|
+
rspec-support (3.10.2)
|
49
|
+
rubocop (1.11.0)
|
50
|
+
parallel (~> 1.10)
|
51
|
+
parser (>= 3.0.0.0)
|
52
|
+
rainbow (>= 2.2.2, < 4.0)
|
53
|
+
regexp_parser (>= 1.8, < 3.0)
|
54
|
+
rexml
|
55
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
56
|
+
ruby-progressbar (~> 1.7)
|
57
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
58
|
+
rubocop-ast (1.4.1)
|
59
|
+
parser (>= 2.7.1.5)
|
60
|
+
rubocop-rails (2.9.1)
|
61
|
+
activesupport (>= 4.2.0)
|
62
|
+
rack (>= 1.1)
|
63
|
+
rubocop (>= 0.90.0, < 2.0)
|
64
|
+
ruby-progressbar (1.11.0)
|
65
|
+
thor (1.1.0)
|
66
|
+
tzinfo (2.0.4)
|
67
|
+
concurrent-ruby (~> 1.0)
|
68
|
+
unicode-display_width (2.0.0)
|
69
|
+
zeitwerk (2.4.2)
|
70
|
+
|
71
|
+
PLATFORMS
|
72
|
+
ruby
|
73
|
+
|
74
|
+
DEPENDENCIES
|
75
|
+
activemodel (~> 6.1.0)
|
76
|
+
appraisal
|
77
|
+
bundler
|
78
|
+
rake (>= 12.3.3)
|
79
|
+
rspec
|
80
|
+
rubocop
|
81
|
+
rubocop-rails
|
82
|
+
validates_zipcode!
|
83
|
+
|
84
|
+
BUNDLED WITH
|
85
|
+
2.2.22
|
@@ -0,0 +1,85 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
validates_zipcode (0.5.1)
|
5
|
+
activemodel (>= 4.2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (7.0.3.1)
|
11
|
+
activesupport (= 7.0.3.1)
|
12
|
+
activesupport (7.0.3.1)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
appraisal (2.4.1)
|
18
|
+
bundler
|
19
|
+
rake
|
20
|
+
thor (>= 0.14.0)
|
21
|
+
ast (2.4.2)
|
22
|
+
concurrent-ruby (1.1.10)
|
23
|
+
diff-lcs (1.5.0)
|
24
|
+
i18n (1.11.0)
|
25
|
+
concurrent-ruby (~> 1.0)
|
26
|
+
json (2.6.2)
|
27
|
+
minitest (5.16.2)
|
28
|
+
parallel (1.22.1)
|
29
|
+
parser (3.1.2.0)
|
30
|
+
ast (~> 2.4.1)
|
31
|
+
rack (2.2.4)
|
32
|
+
rainbow (3.1.1)
|
33
|
+
rake (13.0.6)
|
34
|
+
regexp_parser (2.5.0)
|
35
|
+
rexml (3.2.5)
|
36
|
+
rspec (3.11.0)
|
37
|
+
rspec-core (~> 3.11.0)
|
38
|
+
rspec-expectations (~> 3.11.0)
|
39
|
+
rspec-mocks (~> 3.11.0)
|
40
|
+
rspec-core (3.11.0)
|
41
|
+
rspec-support (~> 3.11.0)
|
42
|
+
rspec-expectations (3.11.0)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.11.0)
|
45
|
+
rspec-mocks (3.11.1)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.11.0)
|
48
|
+
rspec-support (3.11.0)
|
49
|
+
rubocop (1.31.2)
|
50
|
+
json (~> 2.3)
|
51
|
+
parallel (~> 1.10)
|
52
|
+
parser (>= 3.1.0.0)
|
53
|
+
rainbow (>= 2.2.2, < 4.0)
|
54
|
+
regexp_parser (>= 1.8, < 3.0)
|
55
|
+
rexml (>= 3.2.5, < 4.0)
|
56
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
57
|
+
ruby-progressbar (~> 1.7)
|
58
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
59
|
+
rubocop-ast (1.19.1)
|
60
|
+
parser (>= 3.1.1.0)
|
61
|
+
rubocop-rails (2.15.2)
|
62
|
+
activesupport (>= 4.2.0)
|
63
|
+
rack (>= 1.1)
|
64
|
+
rubocop (>= 1.7.0, < 2.0)
|
65
|
+
ruby-progressbar (1.11.0)
|
66
|
+
thor (1.2.1)
|
67
|
+
tzinfo (2.0.4)
|
68
|
+
concurrent-ruby (~> 1.0)
|
69
|
+
unicode-display_width (2.2.0)
|
70
|
+
|
71
|
+
PLATFORMS
|
72
|
+
x86_64-darwin-20
|
73
|
+
|
74
|
+
DEPENDENCIES
|
75
|
+
activemodel (~> 7.0.0)
|
76
|
+
appraisal
|
77
|
+
bundler
|
78
|
+
rake (>= 12.3.3)
|
79
|
+
rspec
|
80
|
+
rubocop
|
81
|
+
rubocop-rails
|
82
|
+
validates_zipcode!
|
83
|
+
|
84
|
+
BUNDLED WITH
|
85
|
+
2.2.22
|
data/gemfiles/rails_edge.gemfile
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
1
|
# This file was generated by Appraisal
|
3
2
|
|
4
|
-
source
|
3
|
+
source "https://rubygems.org"
|
5
4
|
|
6
|
-
gem
|
5
|
+
gem "activemodel", github: "rails/rails"
|
7
6
|
|
8
|
-
gemspec path:
|
7
|
+
gemspec path: "../"
|