mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Return truemail
This reverts commit 862f5639ebbe4d3e6abd5d5be7fb7840e7b83bdf.
This commit is contained in:
parent
0a7b754c4c
commit
e4a02c2e47
35 changed files with 728 additions and 153 deletions
|
@ -3,6 +3,11 @@ require 'test_helper'
|
|||
class ContactTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@contact = contacts(:john)
|
||||
@old_validation_type = Truemail.configure.default_validation_type
|
||||
end
|
||||
|
||||
teardown do
|
||||
Truemail.configure.default_validation_type = @old_validation_type
|
||||
end
|
||||
|
||||
def test_valid_contact_fixture_is_valid
|
||||
|
@ -61,10 +66,17 @@ class ContactTest < ActiveSupport::TestCase
|
|||
assert contact.invalid?
|
||||
end
|
||||
|
||||
def test_validates_email_format
|
||||
def test_email_verification_valid
|
||||
contact = valid_contact
|
||||
contact.email = 'info@internet.ee'
|
||||
assert contact.valid?
|
||||
end
|
||||
|
||||
contact.email = 'invalid'
|
||||
def test_email_verification_smtp_error
|
||||
Truemail.configure.default_validation_type = :smtp
|
||||
|
||||
contact = valid_contact
|
||||
contact.email = 'somecrude1337joke@internet.ee'
|
||||
assert contact.invalid?
|
||||
assert_equal I18n.t('activerecord.errors.models.contact.attributes.email.email_smtp_check_error'), contact.errors.messages[:email].first
|
||||
end
|
||||
|
@ -273,6 +285,16 @@ class ContactTest < ActiveSupport::TestCase
|
|||
assert_equal domain.whois_record.try(:json).try(:[], 'registrant'), @contact.name
|
||||
end
|
||||
|
||||
def test_creates_email_verification_in_unicode
|
||||
unicode_email = 'suur@äri.ee'
|
||||
punycode_email = Contact.unicode_to_punycode(unicode_email)
|
||||
|
||||
@contact.email = punycode_email
|
||||
@contact.save
|
||||
|
||||
assert_equal @contact.email_verification.email, unicode_email
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue