validates_email_format_of 1.6.3 → 1.7.2
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 +5 -5
- data/.github/workflows/ci.yml +67 -0
- data/.gitignore +2 -0
- data/Appraisals +32 -0
- data/CHANGELOG.md +35 -0
- data/README.rdoc +4 -2
- data/config/locales/fr.yml +8 -0
- data/config/locales/it.yml +8 -0
- data/config/locales/ja.yml +8 -0
- data/config/locales/pt-BR.yml +8 -0
- data/config/locales/pt.yml +8 -0
- data/gemfiles/rails_4.2.gemfile +8 -0
- data/gemfiles/rails_5.0.gemfile +8 -0
- data/gemfiles/rails_5.1.gemfile +8 -0
- data/gemfiles/rails_5.2.gemfile +8 -0
- data/gemfiles/rails_6.0.gemfile +7 -0
- data/gemfiles/rails_6.1.gemfile +7 -0
- data/gemfiles/rails_7.0.gemfile +7 -0
- data/lib/validates_email_format_of/active_model.rb +4 -4
- data/lib/validates_email_format_of/railtie.rb +2 -2
- data/lib/validates_email_format_of/rspec_matcher.rb +1 -1
- data/lib/validates_email_format_of/version.rb +1 -1
- data/lib/validates_email_format_of.rb +179 -67
- data/rakefile.rb +4 -1
- data/spec/rspec_matcher_spec.rb +9 -11
- data/spec/spec_helper.rb +6 -3
- data/spec/validates_email_format_of_spec.rb +134 -129
- data/validates_email_format_of.gemspec +21 -19
- metadata +77 -16
- data/.travis.yml +0 -18
- data/CHANGELOG +0 -3
- data/gemfiles/Gemfile.active_model_2_1 +0 -5
- data/gemfiles/Gemfile.active_model_3_0 +0 -5
- data/gemfiles/Gemfile.active_model_3_1 +0 -5
- data/gemfiles/Gemfile.active_model_3_2 +0 -5
- data/gemfiles/Gemfile.active_model_3_3 +0 -5
- data/gemfiles/Gemfile.active_model_4_0 +0 -5
- data/gemfiles/Gemfile.active_model_4_1 +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6220bc1f3cb06d9af63e0bcf8ccfcc6e1dc795a59a5c08cd817ac921a057585b
|
4
|
+
data.tar.gz: 6c0f414549308510ad6434c71b3a1d0cabd88c4fc18cb3a3fb02135b862f3f5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91e1f3eb18440c304f144d81b346134d9c6d7bc747e43fe464edeebb9e3a02e972e7fa4b4283d7b9eed6e4556f37a578d11bb4a9bb0328e93f5f2f2658625a30
|
7
|
+
data.tar.gz: 2e3c8cc64f8d860c0fb1e7771197942901a4fae28b166376b613bbef6262275003bbad62b23e244a3a9887ecb99c5f1dad7bc3f3b973150beaa5774782baed2d
|
@@ -0,0 +1,67 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
name: "Ruby ${{ matrix.ruby }}, Rails ${{ matrix.gemfile }}"
|
15
|
+
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
|
18
|
+
strategy:
|
19
|
+
matrix:
|
20
|
+
ruby: ["2.6", "2.7", "3.0", "3.1"]
|
21
|
+
gemfile: ["4.2", "5.0", "5.1", "5.2", "6.0", "6.1", "7.0"]
|
22
|
+
exclude:
|
23
|
+
- gemfile: "4.2"
|
24
|
+
ruby: "3.0"
|
25
|
+
- gemfile: "4.2"
|
26
|
+
ruby: "3.1"
|
27
|
+
- gemfile: "5.0"
|
28
|
+
ruby: "3.0"
|
29
|
+
- gemfile: "5.0"
|
30
|
+
ruby: "3.1"
|
31
|
+
- gemfile: "5.1"
|
32
|
+
ruby: "3.0"
|
33
|
+
- gemfile: "5.1"
|
34
|
+
ruby: "3.1"
|
35
|
+
- gemfile: "5.2"
|
36
|
+
ruby: "3.0"
|
37
|
+
- gemfile: "5.2"
|
38
|
+
ruby: "3.1"
|
39
|
+
- gemfile: "7.0"
|
40
|
+
ruby: "2.5"
|
41
|
+
- gemfile: "7.0"
|
42
|
+
ruby: "2.6"
|
43
|
+
- gemfile: "7.0"
|
44
|
+
ruby: "2.7"
|
45
|
+
|
46
|
+
env:
|
47
|
+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.gemfile }}.gemfile
|
48
|
+
RAILS_ENV: test
|
49
|
+
|
50
|
+
steps:
|
51
|
+
- uses: actions/checkout@v3
|
52
|
+
|
53
|
+
- name: "Install Ruby ${{ matrix.ruby }}"
|
54
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
55
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
56
|
+
# uses: ruby/setup-ruby@v1
|
57
|
+
uses: ruby/setup-ruby@v1
|
58
|
+
with:
|
59
|
+
bundler: 1
|
60
|
+
ruby-version: ${{ matrix.ruby }}
|
61
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
62
|
+
|
63
|
+
- name: Run specs
|
64
|
+
run: bundle exec rspec
|
65
|
+
|
66
|
+
- name: Run standard.rb
|
67
|
+
run: bundle exec rake standard
|
data/.gitignore
CHANGED
data/Appraisals
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# run `bundle exec appraisal install` after making changes here
|
2
|
+
appraise "rails-7.0" do
|
3
|
+
gem "rails", "~> 7.0"
|
4
|
+
end
|
5
|
+
|
6
|
+
appraise "rails-6.1" do
|
7
|
+
gem "rails", "~> 6.1.0"
|
8
|
+
end
|
9
|
+
|
10
|
+
appraise "rails-6.0" do
|
11
|
+
gem "rails", "~> 6.0.3", ">= 6.0.3.2"
|
12
|
+
end
|
13
|
+
|
14
|
+
appraise "rails-5.2" do
|
15
|
+
gem "rails", "~> 5.2.4", ">= 5.2.4.3"
|
16
|
+
gem "i18n", "< 1"
|
17
|
+
end
|
18
|
+
|
19
|
+
appraise "rails-5.1" do
|
20
|
+
gem "rails", "~> 5.1.7"
|
21
|
+
gem "i18n", "< 1"
|
22
|
+
end
|
23
|
+
|
24
|
+
appraise "rails-5.0" do
|
25
|
+
gem "rails", "~> 5.0.7", ">= 5.0.7.2"
|
26
|
+
gem "i18n", "< 1"
|
27
|
+
end
|
28
|
+
|
29
|
+
appraise "rails-4.2" do
|
30
|
+
gem "rails", "~> 4.2.0"
|
31
|
+
gem "i18n", "< 1"
|
32
|
+
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## [Unreleased]
|
4
|
+
|
5
|
+
[Unreleased]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.7.2...master
|
6
|
+
|
7
|
+
## [1.7.2]
|
8
|
+
|
9
|
+
* Fix regression that disallowed domains starting with number - https://github.com/validates-email-format-of/validates_email_format_of/issues/88
|
10
|
+
|
11
|
+
[Unreleased]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.7.1...v1.7.2
|
12
|
+
|
13
|
+
## [1.7.1] (3 Aug 2022)
|
14
|
+
|
15
|
+
* Fix invalid symbols being allowed in the local part - https://github.com/validates-email-format-of/validates_email_format_of/issues/86
|
16
|
+
* Fix rspec_matcher when using a custom error message - https://github.com/validates-email-format-of/validates_email_format_of/pull/85 - thanks https://github.com/luuqnhu !
|
17
|
+
|
18
|
+
[1.7.1]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.7.0...v1.7.1
|
19
|
+
|
20
|
+
## [1.7.0] (29 July 2022)
|
21
|
+
|
22
|
+
* Use Standard.rb for internal code formatting - https://github.com/validates-email-format-of/validates_email_format_of/commit/db1b0a86af58e478b7f9f2f269bf93bf48dc13c1
|
23
|
+
* Add support for comments in the local part and improve quoted character handling - https://github.com/validates-email-format-of/validates_email_format_of/issues/69
|
24
|
+
* Improve grammar for parsing domain part and validate domain part lengths - https://github.com/validates-email-format-of/validates_email_format_of/commit/2554b55e547c1fae6599d13b0c99296752888c91
|
25
|
+
* Do not strip spaces before validating - https://github.com/validates-email-format-of/validates_email_format_of/issues/61 and https://github.com/validates-email-format-of/validates_email_format_of/issues/72
|
26
|
+
* Allow setting check_mx_timeout and reduce the default timeout to 3 seconds - https://github.com/validates-email-format-of/validates_email_format_of/issues/66
|
27
|
+
* Fix regex duplicate character warning - https://github.com/validates-email-format-of/validates_email_format_of/pull/71
|
28
|
+
* Update CI to include Ruby 2.6 to 3.1 and Rails 4.2 to 7.0
|
29
|
+
|
30
|
+
[1.7.0]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.6.1...v1.7.0
|
31
|
+
## [1.6.1] (8 Sept 2014)
|
32
|
+
|
33
|
+
* In a Rails context, this gem now uses ActiveModel's default logic for constructing I18n keys, to make it easier to override them on a model/attribute basis.
|
34
|
+
|
35
|
+
[1.6.1]: https://github.com/validates-email-format-of/validates_email_format_of/compare/v1.6.0...v1.6.1
|
data/README.rdoc
CHANGED
@@ -40,6 +40,8 @@ Or in your Gemfile:
|
|
40
40
|
String. A custom error message when the email format is invalid (default is: "does not appear to be a valid e-mail address")
|
41
41
|
:check_mx
|
42
42
|
Boolean. Check domain for a valid MX record (default is false)
|
43
|
+
:check_mx_timeout
|
44
|
+
Integer. Timeout in seconds for checking MX records before a `ResolvTimeout` is raised (default is 3).
|
43
45
|
:mx_message
|
44
46
|
String. A custom error message when the domain does not match a valid MX record (default is: "is not routable"). Ignored unless :check_mx option is true.
|
45
47
|
:local_length
|
@@ -56,7 +58,7 @@ Or in your Gemfile:
|
|
56
58
|
|
57
59
|
== Testing
|
58
60
|
|
59
|
-
To execute the unit tests run <tt>rspec</tt>.
|
61
|
+
To execute the unit tests against [all the Rails versions we support run](gemfiles/) <tt>bundle exec appraisal rspec</tt> or run against an individual version with <tt>bundle exec appraisal rails-6.0 rspec</tt>.
|
60
62
|
|
61
63
|
Tested in Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.2, JRuby and REE 1.8.7.
|
62
64
|
|
@@ -83,7 +85,7 @@ Yes, our Rspec syntax is that simple!
|
|
83
85
|
|
84
86
|
== Credits
|
85
87
|
|
86
|
-
Written by Alex Dunae (dunae.ca), 2006-
|
88
|
+
Written by Alex Dunae (dunae.ca), 2006-22.
|
87
89
|
|
88
90
|
Many thanks to the plugin's recent contributors: https://github.com/alexdunae/validates_email_format_of/contributors
|
89
91
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "validates_email_format_of"
|
2
|
+
require "active_model"
|
3
3
|
|
4
|
-
if ActiveModel::VERSION::MAJOR < 2 || (
|
4
|
+
if ActiveModel::VERSION::MAJOR < 2 || (ActiveModel::VERSION::MAJOR == 2 && ActiveModel::VERSION::MINOR < 1)
|
5
5
|
puts "WARNING: ActiveModel validation helper methods in validates_email_format_of gem are not compatible with ActiveModel < 2.1.0. Please use ValidatesEmailFormatOf::validate_email_format(email, options) or upgrade ActiveModel"
|
6
6
|
end
|
7
7
|
|
@@ -9,7 +9,7 @@ module ActiveModel
|
|
9
9
|
module Validations
|
10
10
|
class EmailFormatValidator < EachValidator
|
11
11
|
def validate_each(record, attribute, value)
|
12
|
-
(ValidatesEmailFormatOf
|
12
|
+
(ValidatesEmailFormatOf.validate_email_format(value, options.merge(generate_message: true)) || []).each do |error|
|
13
13
|
record.errors.add(attribute, error)
|
14
14
|
end
|
15
15
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ValidatesEmailFormatOf
|
2
2
|
class Railtie < Rails::Railtie
|
3
|
-
initializer
|
4
|
-
ValidatesEmailFormatOf
|
3
|
+
initializer "validates_email_format_of.load_i18n_locales" do |app|
|
4
|
+
ValidatesEmailFormatOf.load_i18n_locales
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
@@ -6,7 +6,7 @@ RSpec::Matchers.define :validate_email_format_of do |attribute|
|
|
6
6
|
actual.send(:"#{attribute}=", "invalid@example.")
|
7
7
|
expect(actual).to be_invalid
|
8
8
|
@expected_message ||= ValidatesEmailFormatOf.default_message
|
9
|
-
expect(actual.errors.
|
9
|
+
expect(actual.errors.added?(attribute, @expected_message)).to be_truthy
|
10
10
|
end
|
11
11
|
chain :with_message do |message|
|
12
12
|
@expected_message = message
|