validates_email_format_of 1.6.1 → 1.7.0
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 -13
 - data/.github/workflows/ci.yml +67 -0
 - data/.gitignore +2 -0
 - data/Appraisals +32 -0
 - data/CHANGELOG +10 -0
 - data/README.rdoc +3 -1
 - data/config/locales/de.yml +8 -0
 - 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 +2 -3
 - data/lib/validates_email_format_of/version.rb +1 -1
 - data/lib/validates_email_format_of.rb +170 -67
 - data/rakefile.rb +4 -1
 - data/spec/rspec_matcher_spec.rb +9 -11
 - data/spec/spec_helper.rb +6 -10
 - data/spec/validates_email_format_of_spec.rb +139 -129
 - data/validates_email_format_of.gemspec +25 -18
 - metadata +87 -25
 - data/.travis.yml +0 -18
 - 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,15 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                YTg5ZGY1MWEzYWFkYTUzOTVlYzQ0N2FlZGRjNDY0OWY0ZmU2NTA3OA==
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 42557ade4662b6a601647924b0a35b0ef09ad48077368e2296185b765902f6b8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ec3bdeed382f2f2af17377a529ef02e9d5271c77b4f810467403265f0b273f3d
         
     | 
| 
       7 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                YjQyNDI0ZmYyZGRhZmYwN2U0MjEyYzVmYzJmZDk1ZDAwMjcwOWZhOGU2YTZl
         
     | 
| 
       11 
     | 
    
         
            -
                MjdjNmIyNDE3ZjE5YzJmOGI2ZGVjZWRiMWI5ZDFkNjQ1NzRiYjg=
         
     | 
| 
       12 
     | 
    
         
            -
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                YTI2Zjg0ZjQ3MzRlZTE2MjEzOTI2NjkwZDUzYjk3MjRmYmYzZDJhNmYzOTUz
         
     | 
| 
       14 
     | 
    
         
            -
                YWM2MDJiZjkxOGQyNmU2ZDVlZTZiNDMwYWY2YzcwMzU3ZWYyNjVmYmQ1Mzc3
         
     | 
| 
       15 
     | 
    
         
            -
                MzY1YTgxZmJlMDBiODgyYjVmYmZlZDM0NDhlZGQwYmIyOWM0NTU=
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: dfea65637b8d575356d3309e63c9947e0e434d53a261f520a918f889f2849f1d44249dfeb74f81dec47dd78e1b5d2d8093f1dcd97652c9d3d7507b2c51d9b5e4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0e1420665dd0b6ebe42bb6555552ea31bfedac10c62076f65b43112f62c52246bae37d8c857a3d0816c5ddd54f06d20ac124977b02d151bfd81a78ffc065d7af
         
     | 
| 
         @@ -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
    CHANGED
    
    | 
         @@ -1,3 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            == 1.7.0 (29 July 2022)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Use Standard.rb for internal code formatting - https://github.com/validates-email-format-of/validates_email_format_of/commit/db1b0a86af58e478b7f9f2f269bf93bf48dc13c1
         
     | 
| 
      
 4 
     | 
    
         
            +
            * 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
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Improve grammar for parsing domain part and validate domain part lengths - https://github.com/validates-email-format-of/validates_email_format_of/commit/2554b55e547c1fae6599d13b0c99296752888c91
         
     | 
| 
      
 6 
     | 
    
         
            +
            * 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
         
     | 
| 
      
 7 
     | 
    
         
            +
            * 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
         
     | 
| 
      
 8 
     | 
    
         
            +
            * Fix regex duplicate character warning - https://github.com/validates-email-format-of/validates_email_format_of/pull/71
         
     | 
| 
      
 9 
     | 
    
         
            +
            * Update CI to include Ruby 2.6 to 3.1 and Rails 4.2 to 7.0
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       1 
11 
     | 
    
         
             
            == 1.6.1 (8 Sept 2014)
         
     | 
| 
       2 
12 
     | 
    
         | 
| 
       3 
13 
     | 
    
         
             
            * 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.
         
     | 
    
        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 
     | 
    
         | 
| 
         @@ -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
         
     | 
| 
         @@ -2,12 +2,11 @@ require "validates_email_format_of" 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            RSpec::Matchers.define :validate_email_format_of do |attribute|
         
     | 
| 
       4 
4 
     | 
    
         
             
              match do
         
     | 
| 
       5 
     | 
    
         
            -
                 
     | 
| 
       6 
     | 
    
         
            -
                actual = actual_class_name.new
         
     | 
| 
      
 5 
     | 
    
         
            +
                actual = subject.is_a?(Class) ? subject.new : subject
         
     | 
| 
       7 
6 
     | 
    
         
             
                actual.send(:"#{attribute}=", "invalid@example.")
         
     | 
| 
       8 
7 
     | 
    
         
             
                expect(actual).to be_invalid
         
     | 
| 
       9 
8 
     | 
    
         
             
                @expected_message ||= ValidatesEmailFormatOf.default_message
         
     | 
| 
       10 
     | 
    
         
            -
                expect(actual.errors. 
     | 
| 
      
 9 
     | 
    
         
            +
                expect(actual.errors.added?(attribute, :invalid_email_address)).to be_truthy
         
     | 
| 
       11 
10 
     | 
    
         
             
              end
         
     | 
| 
       12 
11 
     | 
    
         
             
              chain :with_message do |message|
         
     | 
| 
       13 
12 
     | 
    
         
             
                @expected_message = message
         
     |