mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
parent
f35b2dc36c
commit
5d63feb0a5
43 changed files with 262 additions and 816 deletions
41
test/mailers/domain_delete_mailer_test.rb
Normal file
41
test/mailers/domain_delete_mailer_test.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainDeleteMailerTest < ActiveSupport::TestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_force_delete_templates
|
||||
assert_equal %w[private_person legal_person], DomainDeleteMailer.force_delete_templates
|
||||
end
|
||||
|
||||
def test_delivers_domain_delete_confirmation_email
|
||||
assert_equal 'shop.test', @domain.name
|
||||
|
||||
email = DomainDeleteMailer.confirm(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
registrant: @domain.registrant).deliver_now
|
||||
|
||||
assert_emails 1
|
||||
assert_equal 'Kinnitustaotlus domeeni shop.test kustutamiseks .ee registrist' \
|
||||
' / Application for approval for deletion of shop.test', email.subject
|
||||
end
|
||||
|
||||
def test_delivers_domain_force_delete_email
|
||||
assert_equal 'shop.test', @domain.name
|
||||
|
||||
email = DomainDeleteMailer.forced(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
registrant: @domain.registrant,
|
||||
template_name: DomainDeleteMailer.force_delete_templates
|
||||
.first).deliver_now
|
||||
|
||||
assert_emails 1
|
||||
assert_equal 'Domeen shop.test on kustutusmenetluses' \
|
||||
' / Domain shop.test is in deletion process' \
|
||||
' / Домен shop.test в процессе удаления', email.subject
|
||||
end
|
||||
end
|
20
test/mailers/domain_expire_mailer_test.rb
Normal file
20
test/mailers/domain_expire_mailer_test.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainExpireMailerTest < ActiveSupport::TestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_delivers_domain_expiration_email
|
||||
domain = domains(:shop)
|
||||
assert_equal 'shop.test', domain.name
|
||||
|
||||
email = DomainExpireMailer.expired(domain: domain, registrar: domain.registrar).deliver_now
|
||||
|
||||
assert_emails 1
|
||||
assert_equal 'Domeen shop.test on aegunud / Domain shop.test has expired' \
|
||||
' / Срок действия домена shop.test истек', email.subject
|
||||
end
|
||||
end
|
|
@ -70,4 +70,13 @@ class DomainTest < ActiveSupport::TestCase
|
|||
assert_not_includes Domain.registrant_user_administered_domains(registrant_user), @domain
|
||||
end
|
||||
end
|
||||
|
||||
def test_returns_primary_contact_emails
|
||||
assert_equal 'john@inbox.test', @domain.registrant.email
|
||||
assert_equal 'john@inbox.test', contacts(:john).email
|
||||
assert_equal 'william@inbox.test', contacts(:william).email
|
||||
@domain.admin_contacts = [contacts(:john), contacts(:william)]
|
||||
|
||||
assert_equal %w[john@inbox.test william@inbox.test], @domain.primary_contact_emails
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue