Sha256: f5896ba1de65555e294f9460ba06b752aa83cc9d76cce1a9e50f944f47cc3f87

Contents?: true

Size: 625 Bytes

Versions: 5

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

require "test_helper"

class DisposableEmailTest < Minitest::Test
  DISPOSABLE_EMAILS.each do |domain|
    test "rejects disposable e-mail (#{domain})" do
      User.validates_email_format_of :email

      user = User.new(email: "user@#{domain}")
      user.valid?

      assert_includes user.errors[:email], I18n.t("activerecord.errors.messages.disposable_email")
    end
  end

  test "accepts disposable e-mail" do
    User.validates_email_format_of :email, disposable: true

    user = User.new(email: "user@mailinator.com")
    user.valid?

    assert user.errors[:email].empty?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
validators-3.0.4 test/validators/disposable_email_test.rb
validators-3.0.3 test/validators/disposable_email_test.rb
validators-3.0.2 test/validators/disposable_email_test.rb
validators-3.0.1 test/validators/disposable_email_test.rb
validators-3.0.0 test/validators/disposable_email_test.rb