diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb
index 69276df0e5..2b94607c53 100644
--- a/app/controllers/admin/domains_controller.rb
+++ b/app/controllers/admin/domains_controller.rb
@@ -107,7 +107,7 @@ def normalize_search_parameters
end
def force_delete_templates
- %w(removed_company death)
+ DomainDeleteMailer.force_delete_templates
end
end
end
diff --git a/app/mailers/domain_delete_mailer.rb b/app/mailers/domain_delete_mailer.rb
index 1b527ef3c2..aa4d385338 100644
--- a/app/mailers/domain_delete_mailer.rb
+++ b/app/mailers/domain_delete_mailer.rb
@@ -1,4 +1,8 @@
class DomainDeleteMailer < ApplicationMailer
+ def self.force_delete_templates
+ %w[private_person legal_person]
+ end
+
def confirm(domain:, registrar:, registrant:)
@domain = DomainPresenter.new(domain: domain, view: view_context)
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
@@ -13,7 +17,6 @@ def forced(domain:, registrar:, registrant:, template_name:)
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
@registrant = RegistrantPresenter.new(registrant: registrant, view: view_context)
- @force_delete_set_date = Time.zone.now
@redemption_grace_period = Setting.redemption_grace_period
subject = default_i18n_subject(domain_name: domain.name)
diff --git a/app/models/contact.rb b/app/models/contact.rb
index bce9ae3c06..1ad3388065 100644
--- a/app/models/contact.rb
+++ b/app/models/contact.rb
@@ -242,10 +242,6 @@ def pdf(html)
kit.to_pdf
end
- def names
- pluck(:name)
- end
-
def emails
pluck(:email)
end
diff --git a/app/models/domain.rb b/app/models/domain.rb
index fd5d920c2a..5ae0cbbb6b 100644
--- a/app/models/domain.rb
+++ b/app/models/domain.rb
@@ -597,24 +597,8 @@ def status_notes_array=(notes)
end
end
- def admin_contact_names
- admin_contacts.names
- end
-
- def admin_contact_emails
- admin_contacts.emails
- end
-
- def tech_contact_names
- tech_contacts.names
- end
-
- def nameserver_hostnames
- nameservers.hostnames
- end
-
def primary_contact_emails
- (admin_contact_emails << registrant_email).uniq
+ (admin_contacts.emails + [registrant.email]).uniq
end
def new_registrant_email
diff --git a/app/presenters/domain_presenter.rb b/app/presenters/domain_presenter.rb
index d58163aaeb..1a99bf3a16 100644
--- a/app/presenters/domain_presenter.rb
+++ b/app/presenters/domain_presenter.rb
@@ -42,18 +42,6 @@ def force_delete_date
view.l(domain.force_delete_date) if domain.force_delete_scheduled?
end
- def admin_contact_names
- domain.admin_contact_names.join(', ')
- end
-
- def tech_contact_names
- domain.tech_contact_names.join(', ')
- end
-
- def nameserver_names
- domain.nameserver_hostnames.join(', ')
- end
-
def force_delete_toggle_btn
return inactive_schedule_force_delete_btn if domain.discarded?
diff --git a/app/views/mailers/domain_delete_mailer/forced/legal_person.html.erb b/app/views/mailers/domain_delete_mailer/forced/legal_person.html.erb
new file mode 100644
index 0000000000..9502a9fe8c
--- /dev/null
+++ b/app/views/mailers/domain_delete_mailer/forced/legal_person.html.erb
@@ -0,0 +1,47 @@
+
Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt
+
+Eesti Interneti Sihtasutusele on saanud teatavaks, et juriidiline isik registrikoodiga <%= @registrant.reg_no %> on äriregistrist kustutatud.
+
+Kuna äriregistrist kustutatud juriidiline isik ei saa olla domeeni registreerijaks, algas domeeni <%= @domain.name %> suhtes <%= @redemption_grace_period %> päevane kustutusmenetlus. Menetluse käigus on domeen internetis kättesaadav.
+
+Domeeni suhtes õigust omaval isikul on võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @registrar.name %> domeeni üleandmise taotlus koos seda tõendava dokumendiga.
+
+Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, läheb domeen <%= @domain.name %> <%= @domain.force_delete_date %> domeenioksjonile .ee oksjonikeskkonda. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit.
+
+Lisaküsimuste korral võtke palun ühendust oma registripidajaga:
+<%= render 'mailers/shared/registrar/registrar.et.html', registrar: @registrar %>
+
+<%= render 'mailers/shared/signatures/signature.et.html' %>
+
+
+
+Dear registrant/administrative contact of .ee domain,
+
+Estonian Internet Foundation has learned that the legal person with registry code <%= @registrant.reg_no %> has been deleted from the Business Registry.
+
+As a terminated legal person cannot be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process has started for the <%= @domain.name %> domain. The domain will remain available on the Internet during the deletion process.
+
+The registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @registrar.name %> with legal documentation.
+
+If the transfer is not made within <%= @redemption_grace_period %> days, the domain <%= @domain.name %> will go to domain auction on <%= @domain.force_delete_date %> in the .ee auction portal. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results here.
+
+Should you have additional questions, please contact your registrar:
+<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %>
+
+<%= render 'mailers/shared/signatures/signature.en.html' %>
+
+
+Уважаемый регистрант/административный контакт домена .ee
+
+Целевому учреждению Eesti Internet (EIS) стало известно, что юридическое лицо с регистрационным кодом <%= @registrant.reg_no %> удалено из коммерческого реестра.
+
+Поскольку удаленное из коммерческого регистра юридическое лицо не может являться регистрантом домена, начат <%= @redemption_grace_period %>-дневный процесс удаления домена <%= @domain.name %>. До завершения процесса домен доступен в Интернете.
+
+Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче домена, представив вместе с ходатайством подтверждающие документы. Документы должны быть представлены регистратору в течение <%= @redemption_grace_period %> дней.
+
+Если передача не состоится в течение <%= @redemption_grace_period %> дней, <%= @domain.force_delete_date %> домен <%= @domain.name %> отправится на доменный аукцион в аукционной среде .ee. Если в течение 24 часов в отношении домена <%= @domain.name %> не поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте здесь.
+
+В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
+<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %>
+
+<%= render 'mailers/shared/signatures/signature.ru.html' %>
\ No newline at end of file
diff --git a/app/views/mailers/domain_delete_mailer/forced/legal_person.text.erb b/app/views/mailers/domain_delete_mailer/forced/legal_person.text.erb
new file mode 100644
index 0000000000..b5810cd5b0
--- /dev/null
+++ b/app/views/mailers/domain_delete_mailer/forced/legal_person.text.erb
@@ -0,0 +1,48 @@
+Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt
+
+Eesti Interneti Sihtasutusele on saanud teatavaks, et juriidiline isik registrikoodiga <%= @registrant.reg_no %> on äriregistrist kustutatud.
+
+Kuna äriregistrist kustutatud juriidiline isik ei saa olla domeeni registreerijaks, algas domeeni <%= @domain.name %> suhtes <%= @redemption_grace_period %> päevane kustutusmenetlus. Menetluse käigus on domeen internetis kättesaadav.
+
+Domeeni suhtes õigust omaval isikul on võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @registrar.name %> domeeni üleandmise taotlus koos seda tõendava dokumendiga.
+
+Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, läheb domeen <%= @domain.name %> <%= @domain.force_delete_date %> domeenioksjonile .ee oksjonikeskkonda. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit.
+
+Lisaküsimuste korral võtke palun ühendust oma registripidajaga:
+<%= render 'mailers/shared/registrar/registrar.et.text', registrar: @registrar %>
+
+<%= render 'mailers/shared/signatures/signature.et.text' %>
+
+--------------------------------------
+
+Dear registrant/administrative contact of .ee domain,
+
+Estonian Internet Foundation has learned that the legal person with registry code <%= @registrant.reg_no %> has been deleted from the Business Registry.
+
+As a terminated legal person cannot be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process has started for the <%= @domain.name %> domain. The domain will remain available on the Internet during the deletion process.
+
+The registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @registrar.name %> with legal documentation.
+
+If the transfer is not made within <%= @redemption_grace_period %> days, the domain <%= @domain.name %> will go to domain auction on <%= @domain.force_delete_date %> in the .ee auction portal. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results here.
+
+Should you have additional questions, please contact your registrar:
+<%= render 'mailers/shared/registrar/registrar.en.text', registrar: @registrar %>
+
+<%= render 'mailers/shared/signatures/signature.en.text' %>
+
+--------------------------------------
+
+Уважаемый регистрант/административный контакт домена .ee
+
+Целевому учреждению Eesti Internet (EIS) стало известно, что юридическое лицо с регистрационным кодом <%= @registrant.reg_no %> удалено из коммерческого реестра.
+
+Поскольку удаленное из коммерческого регистра юридическое лицо не может являться регистрантом домена, начат <%= @redemption_grace_period %>-дневный процесс удаления домена <%= @domain.name %>. До завершения процесса домен доступен в Интернете.
+
+Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче домена, представив вместе с ходатайством подтверждающие документы. Документы должны быть представлены регистратору в течение <%= @redemption_grace_period %> дней.
+
+Если передача не состоится в течение <%= @redemption_grace_period %> дней, <%= @domain.force_delete_date %> домен <%= @domain.name %> отправится на доменный аукцион в аукционной среде .ee. Если в течение 24 часов в отношении домена <%= @domain.name %> не поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте здесь.
+
+В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
+<%= render 'mailers/shared/registrar/registrar.ru.text', registrar: @registrar %>
+
+<%= render 'mailers/shared/signatures/signature.ru.text' %>
\ No newline at end of file
diff --git a/app/views/mailers/domain_delete_mailer/forced/death.html.erb b/app/views/mailers/domain_delete_mailer/forced/private_person.html.erb
similarity index 57%
rename from app/views/mailers/domain_delete_mailer/forced/death.html.erb
rename to app/views/mailers/domain_delete_mailer/forced/private_person.html.erb
index 0213e07d9b..e8863f963c 100644
--- a/app/views/mailers/domain_delete_mailer/forced/death.html.erb
+++ b/app/views/mailers/domain_delete_mailer/forced/private_person.html.erb
@@ -1,38 +1,38 @@
-Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt
+Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt
Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et füüsiline isik isikukoodiga <%= @registrant.id_code %> on surnud ja sellest on möödunud vähemalt 6 kuud.
-Kuna surnud isik ei saa olla domeeni registreerijaks, algas domeeni <%= @domain.name %> suhtes <%= @redemption_grace_period %> päevane kustutusmenetlus. Menetluse käigus on domeen internetis kättesaadav.
+Kuna surnud isik ei saa olla domeeni registreerijaks, algas domeeni <%= @domain.name %> suhtes <%= @redemption_grace_period %> päevane kustutusmenetlus. Menetluse käigus on domeen internetis kättesaadav.
Domeeni suhtes õigust omaval isikul on võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @registrar.name %> domeeni üleandmise taotlus, millele tuleb lisada pärimisõiguse tõend. Dokumentatsioon tuleb esitada registripidajale <%= @redemption_grace_period %> päeva jooksul.
-Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, kustub domeen <%= @domain.name %> 24 tunni jooksul <%= @domain.force_delete_date %> süsteemi poolt juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist “kes ees, see mees” põhimõttel uuesti registreerida.
+Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, läheb domeen <%= @domain.name %> <%= @domain.force_delete_date %> domeenioksjonile .ee oksjonikeskkonda. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit.
Lisaküsimuste korral võtke palun ühendust oma registripidajaga:
<%= render 'mailers/shared/registrar/registrar.et.html', registrar: @registrar %>
-Lugupidamisega
-Eesti Interneti Sihtasutus
-
+<%= render 'mailers/shared/signatures/signature.et.html' %>
+
-Dear registrant/administrative contact of .ee domain,
-Estonian Internet Foundation (EIF) has learned that the natural person <%= @registrant.name %> with identification code <%= @registrant.id_code %> has been deceased more than 6 months.
+Dear registrant/administrative contact of <%= @domain.name %> domain
+
+Estonian Internet Foundation (EIF) has learned that the natural person with identification code <%= @registrant.id_code %> has been deceased more than 6 months.
The registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @registrar.name %>.The application must be submitted together with succession evidence certifying the acquisition of the domain. The relevant documents should be submitted to the registrar within <%= @redemption_grace_period %> days.
-As a deceased natural person can not be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process of <%= @domain.name %> domain has started on <%= l(@force_delete_set_date, format: :date) %>. The domain will remain available on the Internet during the deletion process.
+As a deceased natural person can not be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process of <%= @domain.name %> domain has started. The domain will remain available on the Internet during the deletion process.
-If the transfer has not been made in <%= @redemption_grace_period %> day(s), the domain <%= @domain.name %> will be deleted at a randomly chosen moment within 24 hours on <%= @domain.force_delete_date %>. After deletion it is possible to register the domain on a "first come, first served" basis.
+If the transfer is not made within <%= @redemption_grace_period %> days, the domain <%= @domain.name %> will go to domain auction on <%= @domain.force_delete_date %> in the .ee auction environment. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results here.
Should you have additional questions, please contact your registrar:
<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %>
-Best Regards,
-Estonian Internet Foundation
-
+<%= render 'mailers/shared/signatures/signature.en.html' %>
+
-Уважаемый регистрант/административный контакт домена .ee
+
+Уважаемый регистрант/административный контакт домена <%= @domain.name %>
Целевому учреждению Eesti Internet (EIS) стало известно, что физическое лицо с личным кодом <%= @registrant.id_code %> умерло, и с момента смерти прошло не менее 6 месяцев.
@@ -40,11 +40,9 @@ Estonian Internet Foundation
Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче, представив справку о праве наследования. Документы должны быть представлены регистратору в течение <%= @redemption_grace_period %> дней.
-Если передача домена в течение <%= @redemption_grace_period %> дней не состоялась, домен <%= @domain.name %> <%= @domain.force_delete_date %> удаляется в течение 24 часов в произвольно выбранный системой момент времени. При желании домен можно вновь зарегистрировать после удаления из регистра по принципу "первым пришел ‒ первым обслужен".
+Если передача не состоится в течение <%= @redemption_grace_period %> дней, <%= @domain.force_delete_date %> домен <%= @domain.name %> отправится на доменный аукцион в аукционной среде .ee. Если в течение 24 часов в отношении домена <%= @domain.name %> не поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте здесь.
В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %>
-С уважением,
-Eesti Interneti Sihtasutus
-
+<%= render 'mailers/shared/signatures/signature.ru.html' %>
\ No newline at end of file
diff --git a/app/views/mailers/domain_delete_mailer/forced/death.text.erb b/app/views/mailers/domain_delete_mailer/forced/private_person.text.erb
similarity index 59%
rename from app/views/mailers/domain_delete_mailer/forced/death.text.erb
rename to app/views/mailers/domain_delete_mailer/forced/private_person.text.erb
index b8318b75db..fb68d6b9d8 100644
--- a/app/views/mailers/domain_delete_mailer/forced/death.text.erb
+++ b/app/views/mailers/domain_delete_mailer/forced/private_person.text.erb
@@ -6,31 +6,33 @@ Kuna surnud isik ei saa olla domeeni registreerijaks, algas domeeni <%= @domain.
Domeeni suhtes õigust omaval isikul on võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @registrar.name %> domeeni üleandmise taotlus, millele tuleb lisada pärimisõiguse tõend. Dokumentatsioon tuleb esitada registripidajale <%= @redemption_grace_period %> päeva jooksul.
-Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, kustub domeen <%= @domain.name %> 24 tunni jooksul <%= @domain.force_delete_date %> süsteemi poolt juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist “kes ees, see mees” põhimõttel uuesti registreerida.
+Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, läheb domeen <%= @domain.name %> <%= @domain.force_delete_date %> domeenioksjonile .ee oksjonikeskkonda. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit.
Lisaküsimuste korral võtke palun ühendust oma registripidajaga:
<%= render 'mailers/shared/registrar/registrar.et.text', registrar: @registrar %>
-Lugupidamisega
-Eesti Interneti Sihtasutus
----------------------------------------------------
-Dear registrant/administrative contact of .ee domain,
+<%= render 'mailers/shared/signatures/signature.et.text' %>
-Estonian Internet Foundation (EIF) has learned that the natural person <%= @registrant.name %> with identification code <%= @registrant.id_code %> has been deceased more than 6 months.
+--------------------------------------
+
+Dear registrant/administrative contact of <%= @domain.name %> domain
+
+Estonian Internet Foundation (EIF) has learned that the natural person with identification code <%= @registrant.id_code %> has been deceased more than 6 months.
The registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @registrar.name %>.The application must be submitted together with succession evidence certifying the acquisition of the domain. The relevant documents should be submitted to the registrar within <%= @redemption_grace_period %> days.
-As a deceased natural person can not be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process of <%= @domain.name %> domain has started on <%= l(@force_delete_set_date, format: :date) %>. The domain will remain available on the Internet during the deletion process.
+As a deceased natural person can not be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process of <%= @domain.name %> domain has started. The domain will remain available on the Internet during the deletion process.
-If the transfer has not been made in <%= @redemption_grace_period %> day(s), the domain <%= @domain.name %> will be deleted at a randomly chosen moment within 24 hours on <%= @domain.force_delete_date %>. After deletion it is possible to register the domain on a "first come, first served" basis.
+If the transfer is not made within <%= @redemption_grace_period %> days, the domain <%= @domain.name %> will go to domain auction on <%= @domain.force_delete_date %> in the .ee auction environment. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results here.
Should you have additional questions, please contact your registrar:
<%= render 'mailers/shared/registrar/registrar.en.text', registrar: @registrar %>
-Best Regards,
-Estonian Internet Foundation
----------------------------------------------------
-Уважаемый регистрант/административный контакт домена .ee
+<%= render 'mailers/shared/signatures/signature.en.text' %>
+
+--------------------------------------
+
+Уважаемый регистрант/административный контакт домена <%= @domain.name %>
Целевому учреждению Eesti Internet (EIS) стало известно, что физическое лицо с личным кодом <%= @registrant.id_code %> умерло, и с момента смерти прошло не менее 6 месяцев.
@@ -38,10 +40,9 @@ Estonian Internet Foundation
Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче, представив справку о праве наследования. Документы должны быть представлены регистратору в течение <%= @redemption_grace_period %> дней.
-Если передача домена в течение <%= @redemption_grace_period %> дней не состоялась, домен <%= @domain.name %> <%= @domain.force_delete_date %> удаляется в течение 24 часов в произвольно выбранный системой момент времени. При желании домен можно вновь зарегистрировать после удаления из регистра по принципу "первым пришел ‒ первым обслужен".
+Если передача не состоится в течение <%= @redemption_grace_period %> дней, <%= @domain.force_delete_date %> домен <%= @domain.name %> отправится на доменный аукцион в аукционной среде .ee. Если в течение 24 часов в отношении домена <%= @domain.name %> не поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте здесь.
В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
<%= render 'mailers/shared/registrar/registrar.ru.text', registrar: @registrar %>
-С уважением,
-Eesti Interneti Sihtasutus
+<%= render 'mailers/shared/signatures/signature.ru.text' %>
\ No newline at end of file
diff --git a/app/views/mailers/domain_delete_mailer/forced/removed_company.html.erb b/app/views/mailers/domain_delete_mailer/forced/removed_company.html.erb
deleted file mode 100644
index 785366fee9..0000000000
--- a/app/views/mailers/domain_delete_mailer/forced/removed_company.html.erb
+++ /dev/null
@@ -1,50 +0,0 @@
-Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt
-
-Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et juriidiline isik registrikoodiga <%= @registrant.reg_no %> on äriregistrist kustutatud.
-
-Kuna äriregistrist kustutatud juriidiline isik ei saa olla domeeni registreerijaks, algas domeeni <%= @domain.name %> suhtes <%= @redemption_grace_period %> päevane kustutusmenetlus. Menetluse käigus on domeen internetis kättesaadav.
-
-Domeeni suhtes õigust omaval isikul on võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @registrar.name %> domeeni üleandmise taotlus koos tõendava dokumendiga.
-
-Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, kustub domeen <%= @domain.name %> <%= @domain.force_delete_date %> 24 tunni jooksul süsteemi poolt juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist registrist “kes ees, see mees” põhimõttel uuesti registreerida.
-
-Lisaküsimuste korral võtke palun ühendust oma registripidajaga:
-<%= render 'mailers/shared/registrar/registrar.et.html', registrar: @registrar %>
-
-Lugupidamisega
-Eesti Interneti Sihtasutus
-
-
-Dear registrant/administrative contact of .ee domain,
-
-Estonian Internet Foundation (EIS) has learned that the legal person with registry code <%= @registrant.reg_no %> has been deleted from the Business Registry.
-
-As a terminated legal person cannot be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process has started on <%= l(@force_delete_set_date, format: :date) %> for the <%= @domain.name %> domain. The domain will remain available on the Internet during the deletion process.
-
-The registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @registrar.name %>.
-
-If the transfer has not been made in <%= @redemption_grace_period %> days, the domain <%= @domain.name %> will be deleted at a randomly chosen moment within 24 hours on <%= @domain.force_delete_date %>. After deletion it is possible to register the domain on a "first come, first served" basis.
-
-Should you have additional questions, please contact your registrar:
-<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %>
-
-Best Regards,
-Estonian Internet Foundation
-
-
-Уважаемый регистрант/административный контакт домена .ee
-
-Целевому учреждению Eesti Internet (EIS) стало известно, что юридическое лицо с регистрационным кодом <%= @registrant.reg_no %> удалено из коммерческого реестра.
-
-Поскольку удаленное из коммерческого регистра юридическое лицо не может являться регистрантом домена, <%= l(@force_delete_set_date, format: :date) %> начат <%= @redemption_grace_period %>-дневный процесс удаления домена <%= @domain.name %>. До завершения процесса домен доступен в Интернете.
-
-Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче домена, представив вместе с ходатайством подтверждающие документы. Документы должны быть представлены регистратору в течение <%= @redemption_grace_period %> дней.
-
-Если передача домена в течение <%= @redemption_grace_period %> дней не состоялась, домен <%= @domain.name %> <%= @domain.force_delete_date %> удаляется в течение 24 часов в произвольно выбранный системой момент времени. При желании домен можно вновь зарегистрировать после удаления из регистра по принципу "первым пришел ‒ первым обслужен".
-
-В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
-<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %>
-
-С уважением,
-Eesti Interneti Sihtasutus
-
diff --git a/app/views/mailers/domain_delete_mailer/forced/removed_company.text.erb b/app/views/mailers/domain_delete_mailer/forced/removed_company.text.erb
deleted file mode 100644
index fdc455e189..0000000000
--- a/app/views/mailers/domain_delete_mailer/forced/removed_company.text.erb
+++ /dev/null
@@ -1,47 +0,0 @@
-Lugupeetud domeeni <%= @domain.name %> registreerija/halduskontakt
-
-Eesti Interneti Sihtasutusele (EIS) on saanud teatavaks, et juriidiline isik registrikoodiga <%= @registrant.reg_no %> on äriregistrist kustutatud.
-
-Kuna äriregistrist kustutatud juriidiline isik ei saa olla domeeni registreerijaks, algas domeeni <%= @domain.name %> suhtes <%= @redemption_grace_period %> päevane kustutusmenetlus. Menetluse käigus on domeen internetis kättesaadav.
-
-Domeeni suhtes õigust omaval isikul on võimalus esitada domeeni <%= @domain.name %> registripidajale <%= @registrar.name %> domeeni üleandmise taotlus koos tõendava dokumendiga.
-
-Kui üleandmine ei ole <%= @redemption_grace_period %> päeva jooksul toimunud, kustub domeen <%= @domain.name %> <%= @domain.force_delete_date %> 24 tunni jooksul süsteemi poolt juhuslikult valitud ajahetkel. Soovi korral on võimalik domeen pärast selle kustumist registrist “kes ees, see mees” põhimõttel uuesti registreerida.
-
-Lisaküsimuste korral võtke palun ühendust oma registripidajaga:
-<%= render 'mailers/shared/registrar/registrar.et.text', registrar: @registrar %>
-
-Lugupidamisega
-Eesti Interneti Sihtasutus
----------------------------------------------------
-Dear registrant/administrative contact of .ee domain,
-
-Estonian Internet Foundation (EIS) has learned that the legal person with registry code <%= @registrant.reg_no %> has been deleted from the Business Registry.
-
-As a terminated legal person cannot be the registrant of a domain, a <%= @redemption_grace_period %>-day deletion process has started on <%= l(@force_delete_set_date, format: :date) %> for the <%= @domain.name %> domain. The domain will remain available on the Internet during the deletion process.
-
-The registrant holding a right to the domain name <%= @domain.name %> can submit a domain name transfer application to the registrar <%= @registrar.name %>.
-
-If the transfer has not been made in <%= @redemption_grace_period %> days, the domain <%= @domain.name %> will be deleted at a randomly chosen moment within 24 hours on <%= @domain.force_delete_date %>. After deletion it is possible to register the domain on a "first come, first served" basis.
-
-Should you have additional questions, please contact your registrar:
-<%= render 'mailers/shared/registrar/registrar.en.text', registrar: @registrar %>
-
-Best Regards,
-Estonian Internet Foundation
----------------------------------------------------
-Уважаемый регистрант/административный контакт домена .ee
-
-Целевому учреждению Eesti Internet (EIS) стало известно, что юридическое лицо с регистрационным кодом <%= @registrant.reg_no %> удалено из коммерческого реестра.
-
-Поскольку удаленное из коммерческого регистра юридическое лицо не может являться регистрантом домена, <%= l(@force_delete_set_date, format: :date) %> начат <%= @redemption_grace_period %>-дневный процесс удаления домена <%= @domain.name %>. До завершения процесса домен доступен в Интернете.
-
-Лицо, обладающее правом на домен, может подать регистратору <%= @registrar.name %> домена <%= @domain.name %> ходатайство о передаче домена, представив вместе с ходатайством подтверждающие документы. Документы должны быть представлены регистратору в течение <%= @redemption_grace_period %> дней.
-
-Если передача домена в течение <%= @redemption_grace_period %> дней не состоялась, домен <%= @domain.name %> <%= @domain.force_delete_date %> удаляется в течение 24 часов в произвольно выбранный системой момент времени. При желании домен можно вновь зарегистрировать после удаления из регистра по принципу "первым пришел ‒ первым обслужен".
-
-В случае возникновения дополнительных вопросов свяжитесь, пожалуйста, со своим регистратором:
-<%= render 'mailers/shared/registrar/registrar.ru.text', registrar: @registrar %>
-
-С уважением,
-Eesti Interneti Sihtasutus
diff --git a/app/views/mailers/domain_expire_mailer/expired.html.erb b/app/views/mailers/domain_expire_mailer/expired.html.erb
index c6a83a2d48..58043c7ce7 100644
--- a/app/views/mailers/domain_expire_mailer/expired.html.erb
+++ b/app/views/mailers/domain_expire_mailer/expired.html.erb
@@ -1,79 +1,42 @@
-Domeen <%= @domain.name %> on aegunud
-Lugupeetud .ee domeeni kasutaja
-
-Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= @domain.on_hold_date %> internetis kättesaadav.
-
-Alates <%= @domain.delete_date %> on domeen <%= @domain.name %> avatud registreerimiseks kõigile huvilistele.
-
-Domeeni registreeringu pikendamiseks pöörduge palun oma registripidaja poole:
+Domeen <%= @domain.name %> on aegunud
+
+Lugupeetud .ee domeeni registreerija/halduskontakt
+
+Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= @domain.on_hold_date %> internetis kättesaadav. Domeen <%= @domain.name %> on <%= @domain.delete_date %> domeenioksjonil .ee oksjonikeskkonnas. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit.
+
+Domeeni registreeringu pikendamiseks pöörduge palun oma registripidaja poole:
<%= render 'mailers/shared/registrar/registrar.et.html', registrar: @registrar %>
-
-Domeeni <%= @domain.name %> kohta on registris järgmised andmed:
-
-Registreerija: <%= @domain.registrant_name %>
-Halduskontakt: <%= @domain.admin_contact_names %>
-Tehniline kontakt: <%= @domain.tech_contact_names %>
-Nimeserverid: <%= @domain.nameserver_names %>
-
-
-Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist. <%= ENV['registrant_url'] %>.
-
-Lugupidamisega
-Eesti Interneti Sihtasutus
-
+
+Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist.
+
+<%= render 'mailers/shared/signatures/signature.et.html' %>
+
-
-The <%= @domain.name %> domain has expired
-Dear user of .ee domain,
-
-The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= @domain.on_hold_date %>.
-
-From <%= @domain.delete_date %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis.
-
-To renew the domain registration, please contact your registrar:
+
+Domain <%= @domain.name %> has expired
+
+Dear registrant/administrative contact of .ee domain,
+
+The domain name <%= @domain.name %> has expired and since <%= @domain.on_hold_date %> is no longer available on the Internet. The domain <%= @domain.name %> will be available for domain auction on <%= @domain.delete_date %> in the .ee auction portal. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results.
+
+To renew your domain registration, please contact your registrar:
<%= render 'mailers/shared/registrar/registrar.en.html', registrar: @registrar %>
-
-The following data for the <%= @domain.name %> domain have been entered into the registry:
-
-Registrant: <%= @domain.registrant_name %>
-Administrative contact: <%= @domain.admin_contact_names %>
-Technical contact: <%= @domain.tech_contact_names %>
-Name servers: <%= @domain.nameserver_names %>
-
-
-You can find an overview of all your domains at the registrant's portal. <%= ENV['registrant_url'] %>.
-
-Best Regards,
-Estonian Internet Foundation
-
-
-
-Домен <%= @domain.name %> устарел
-Уважаемый пользователь домена .ee
-
-Доменное имя <%= @domain.name %> устарело и с <%= @domain.on_hold_date %> недоступно в Интернете.
-
-С <%= @domain.delete_date %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served".
+You can find an overview of all your domains at the registrant's portal.
-
+<%= render 'mailers/shared/signatures/signature.en.html' %>
-Для продления регистрации домена просим обратиться к своему регистратору:
-<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %>
-
+
-Относительно домена <%= @domain.name %> в реестр внесены следующие данные:
-
+Срок действия домена <%= @domain.name %> истек
-Регистрант: <%= @domain.registrant_name %>
-Административный контакт: <%= @domain.admin_contact_names %>
-Технический контакт: <%= @domain.tech_contact_names %>
-Серверы доменных имен: <%= @domain.nameserver_names %>
+Уважаемый регистрант/административный контакт домена .ee
+Срок действия доменного имени <%= @domain.name %> истек, и с <%= @domain.on_hold_date %> оно больше не доступно в интернете. <%= @domain.delete_date %> домен <%= @domain.name %> будет представлен на доменном аукционе в аукционной среде .ee. Если в течение 24 часов в отношении домена <%= @domain.name %> не поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». Читайте о других возможных результатах аукциона.
-Обзор всех связанных с Вами доменов можете получить на портале регистранта. <%= ENV['registrant_url'] %>.
+Для продления регистрации домена обратитесь, пожалуйста, к своему регистратору:
+<%= render 'mailers/shared/registrar/registrar.ru.html', registrar: @registrar %>
-
+Обзор всех связанных с вами доменов можете получить на портале регистратора.
-С наилучшими пожеланиями
-Целевое учреждение Eesti Internet
+<%= render 'mailers/shared/signatures/signature.ru.html' %>
\ No newline at end of file
diff --git a/app/views/mailers/domain_expire_mailer/expired.text.erb b/app/views/mailers/domain_expire_mailer/expired.text.erb
index c64735d2b7..7bd0ffde68 100644
--- a/app/views/mailers/domain_expire_mailer/expired.text.erb
+++ b/app/views/mailers/domain_expire_mailer/expired.text.erb
@@ -1,69 +1,42 @@
Domeen <%= @domain.name %> on aegunud
-Lugupeetud .ee domeeni kasutaja
-Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= @domain.on_hold_date %> internetis kättesaadav.
-Alates <%= @domain.delete_date %> on domeen <%= @domain.name %> avatud registreerimiseks kõigile huvilistele.
+Lugupeetud .ee domeeni registreerija/halduskontakt
-Domeeni registreeringu pikendamiseks pöörduge palun oma registripidaja poole:
+Domeeninimi <%= @domain.name %> on aegunud ja ei ole alates <%= @domain.on_hold_date %> internetis kättesaadav. Domeen <%= @domain.name %> on <%= @domain.delete_date %> domeenioksjonil .ee https://oksjon.internet.ee. Juhul kui domeenile <%= @domain.name %> ei tehta oksjonil 24h möödudes pakkumist, domeen vabaneb ja on registreerimiseks vabalt kättesaadav kõigile huvilistele. Muude võimalike oksjoni tulemuste kohta loe siit https://www.internet.ee/domeenid/domeenide-oksjonikeskkonna-kasutajatingimused#3-oksjonikeskkonna-enampakkumisel-osalemise-tingimused.
+Domeeni registreeringu pikendamiseks pöörduge palun oma registripidaja poole:
<%= render 'mailers/shared/registrar/registrar.et.text', registrar: @registrar %>
-Domeeni <%= @domain.name %> kohta on registris järgmised andmed:
-
-Registreerija: <%= @domain.registrant_name %>
-Halduskontakt: <%= @domain.admin_contact_names %>
-Tehniline kontakt: <%= @domain.tech_contact_names %>
-Nimeserverid: <%= @domain.nameserver_names %>
-
-Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist. <%= ENV['registrant_url'] %>.
+Ülevaate kõikidest endaga seotud domeenidest saate registreerija portaalist https://registrant.internet.ee/registrant/.
-Parimate soovidega
-Eesti Interneti Sihtasutus
+<%= render 'mailers/shared/signatures/signature.et.text' %>
--------------------------------------
-The <%= @domain.name %> domain has expired
-Dear user of .ee domain,
+Domain <%= @domain.name %> has expired
-The domain name <%= @domain.name %> has expired and will not be available on the Internet from <%= @domain.on_hold_date %>.
-From <%= @domain.delete_date %>, the <%= @domain.name %> domain will be available for registration on a first come first served basis.
+Dear registrant/administrative contact of .ee domain,
-To renew the domain registration, please contact your registrar:
+The domain name <%= @domain.name %> has expired and since <%= @domain.on_hold_date %> is no longer available on the Internet. The domain <%= @domain.name %> will be available for domain auction on <%= @domain.delete_date %> in the .ee auction portal at https://auction.internet.ee. If no offer is made for the domain <%= @domain.name %> at auction within 24 hours, the domain will be released and made freely available for registration to anyone interested on a first-come, first-served basis. Read more about other potential auction results at https://www.internet.ee/domains/auction-environment-user-agreement#3-terms-and-conditions-for-participation-in-the-auction-of-the-auction-environment.
+To renew your domain registration, please contact your registrar:
<%= render 'mailers/shared/registrar/registrar.en.text', registrar: @registrar %>
-The following data for the <%= @domain.name %> domain have been entered into the registry:
+You can find an overview of all your domains at the registrant's portal https://registrant.internet.ee/registrant/.
-Registrant: <%= @domain.registrant_name %>
-Administrative contact: <%= @domain.admin_contact_names %>
-Technical contact: <%= @domain.tech_contact_names %>
-Name servers: <%= @domain.nameserver_names %>
-
-You can find an overview of all your domains at the registrant's portal. <%= ENV['registrant_url'] %>.
-
-Best Regards,
-Estonian Internet Foundation
+<%= render 'mailers/shared/signatures/signature.en.text' %>
--------------------------------------
-Домен <%= @domain.name %> устарел
-Уважаемый пользователь домена .ee
+Срок действия домена <%= @domain.name %> истек
-Доменное имя <%= @domain.name %> устарело и с <%= @domain.on_hold_date %> недоступно в Интернете.
-С <%= @domain.delete_date %> домен <%= @domain.name %> доступен для регистрации всем желающим по принципу "first come, first served".
+Уважаемый регистрант/административный контакт домена .ee
-Для продления регистрации домена просим обратиться к своему регистратору:
+Срок действия доменного имени <%= @domain.name %> истек, и с <%= @domain.on_hold_date %> оно больше не доступно в интернете. <%= @domain.delete_date %> домен <%= @domain.name %> будет представлен на доменном аукционе в аукционной среде .ee https://oksjon.internet.ee. Если в течение 24 часов в отношении домена <%= @domain.name %> не поступит предложений, домен освободится и станет доступным для всех желающих по принципу «кто раньше». О других возможных результатах аукциона читайте по ссылке https://www.internet.ee/domeny/dogovor-pol-zovatelya-aukcionnoj-sredy#3-usloviya-uchastiya-v-aukcione.
+Для продления регистрации домена обратитесь, пожалуйста, к своему регистратору:
<%= render 'mailers/shared/registrar/registrar.ru.text', registrar: @registrar %>
-Относительно домена <%= @domain.name %> в реестр внесены следующие данные:
-
-Регистрант: <%= @domain.registrant_name %>
-Административный контакт: <%= @domain.admin_contact_names %>
-Технический контакт: <%= @domain.tech_contact_names %>
-Серверы доменных имен: <%= @domain.nameserver_names %>
-
-Обзор всех связанных с Вами доменов можете получить на портале регистранта. <%= ENV['registrant_url'] %>.
+Обзор всех связанных с вами доменов можете получить на портале регистратора https://registrant.internet.ee/registrant/
-С наилучшими пожеланиями
-Целевое учреждение Eesti Internet
+<%= render 'mailers/shared/signatures/signature.ru.text' %>
\ No newline at end of file
diff --git a/app/views/mailers/shared/signatures/_signature.en.html.erb b/app/views/mailers/shared/signatures/_signature.en.html.erb
new file mode 100644
index 0000000000..bbf2004ea2
--- /dev/null
+++ b/app/views/mailers/shared/signatures/_signature.en.html.erb
@@ -0,0 +1 @@
+Best Regards,
Estonian Internet Foundation
\ No newline at end of file
diff --git a/app/views/mailers/shared/signatures/_signature.en.text.erb b/app/views/mailers/shared/signatures/_signature.en.text.erb
new file mode 100644
index 0000000000..faa1780543
--- /dev/null
+++ b/app/views/mailers/shared/signatures/_signature.en.text.erb
@@ -0,0 +1,2 @@
+Best Regards,
+Estonian Internet Foundation
\ No newline at end of file
diff --git a/app/views/mailers/shared/signatures/_signature.et.html.erb b/app/views/mailers/shared/signatures/_signature.et.html.erb
new file mode 100644
index 0000000000..cc03756e14
--- /dev/null
+++ b/app/views/mailers/shared/signatures/_signature.et.html.erb
@@ -0,0 +1 @@
+Lugupidamisega
Eesti Interneti Sihtasutus
\ No newline at end of file
diff --git a/app/views/mailers/shared/signatures/_signature.et.text.erb b/app/views/mailers/shared/signatures/_signature.et.text.erb
new file mode 100644
index 0000000000..1c43c2f6d1
--- /dev/null
+++ b/app/views/mailers/shared/signatures/_signature.et.text.erb
@@ -0,0 +1,2 @@
+Lugupidamisega
+Eesti Interneti Sihtasutus
\ No newline at end of file
diff --git a/app/views/mailers/shared/signatures/_signature.ru.html.erb b/app/views/mailers/shared/signatures/_signature.ru.html.erb
new file mode 100644
index 0000000000..25f7fbf285
--- /dev/null
+++ b/app/views/mailers/shared/signatures/_signature.ru.html.erb
@@ -0,0 +1 @@
+С уважением,
Eesti Interneti Sihtasutus
\ No newline at end of file
diff --git a/app/views/mailers/shared/signatures/_signature.ru.text.erb b/app/views/mailers/shared/signatures/_signature.ru.text.erb
new file mode 100644
index 0000000000..630d40e50a
--- /dev/null
+++ b/app/views/mailers/shared/signatures/_signature.ru.text.erb
@@ -0,0 +1,2 @@
+С уважением,
+Eesti Interneti Sihtasutus
\ No newline at end of file
diff --git a/config/application.rb b/config/application.rb
index 1420d3cd3a..26da91b5de 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -77,6 +77,9 @@ class Application < Rails::Application
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
+ # Override "spec/mailers/previews" that RSpec sets
+ config.action_mailer.preview_path = "#{Rails.root}/test/mailers/previews"
+
config.action_mailer.smtp_settings = {
address: ENV['smtp_address'],
port: ENV['smtp_port'],
diff --git a/config/environments/staging-example.rb b/config/environments/staging-example.rb
index 8af2ff60de..b6d2450065 100644
--- a/config/environments/staging-example.rb
+++ b/config/environments/staging-example.rb
@@ -1 +1,5 @@
require_relative 'production'
+
+Rails.application.configure do
+ config.action_mailer.show_previews = true
+end
\ No newline at end of file
diff --git a/config/locales/mailers/domain_expire.en.yml b/config/locales/mailers/domain_expire.en.yml
index 3fb6e97daf..9a83a7a323 100644
--- a/config/locales/mailers/domain_expire.en.yml
+++ b/config/locales/mailers/domain_expire.en.yml
@@ -1,4 +1,7 @@
en:
domain_expire_mailer:
expired:
- subject: The %{domain_name} domain has expired
+ subject: >-
+ Domeen %{domain_name} on aegunud
+ / Domain %{domain_name} has expired
+ / Срок действия домена %{domain_name} истек
\ No newline at end of file
diff --git a/spec/mailers/domain_delete_mailer_spec.rb b/spec/mailers/domain_delete_mailer_spec.rb
deleted file mode 100644
index fa963d9698..0000000000
--- a/spec/mailers/domain_delete_mailer_spec.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe DomainDeleteMailer do
- describe '#confirm' do
- let(:domain) { instance_spy(Domain, name: 'test.com') }
- let(:registrar) { instance_spy(Registrar) }
- let(:registrant) { instance_spy(Registrant, email: 'registrant@test.com') }
-
- let(:domain_presenter) { instance_spy(DomainPresenter) }
- let(:registrar_presenter) { instance_spy(RegistrarPresenter) }
-
- subject(:message) { described_class.confirm(domain: domain,
- registrar: registrar,
- registrant: registrant)
- }
-
- before :example do
- expect(DomainPresenter).to receive(:new).and_return(domain_presenter)
- expect(RegistrarPresenter).to receive(:new).and_return(registrar_presenter)
- end
-
- it 'has sender' do
- expect(message.from).to eq(['noreply@internet.ee'])
- end
-
- it 'has registrant\'s email as a recipient' do
- expect(message.to).to match_array(['registrant@test.com'])
- end
-
- it 'has subject' do
- subject = 'Kinnitustaotlus domeeni test.com kustutamiseks .ee registrist' \
- ' / Application for approval for deletion of test.com'
-
- expect(message.subject).to eq(subject)
- end
-
- it 'has confirm url' do
- allow(domain).to receive(:id).and_return(1)
- expect(domain).to receive(:registrant_verification_token).and_return('test')
- url = registrant_domain_delete_confirm_url(domain, token: 'test')
- expect(message.body.parts.first.decoded).to include(url)
- end
-
- it 'sends message' do
- expect { message.deliver_now }.to change { ActionMailer::Base.deliveries.count }.by(1)
- end
- end
-
- describe '#forced' do
- let(:domain) { instance_spy(Domain, name: 'test.com') }
- let(:registrant) { instance_spy(Registrant) }
- let(:template_name) { 'removed_company' }
-
- let(:domain_presenter) { instance_spy(DomainPresenter) }
- let(:registrar_presenter) { instance_spy(RegistrarPresenter) }
- let(:registrant_presenter) { instance_spy(RegistrantPresenter) }
- subject(:message) { described_class.forced(domain: domain,
- registrar: 'registrar',
- registrant: registrant,
- template_name: template_name)
- }
-
- before :example do
- expect(DomainPresenter).to receive(:new).and_return(domain_presenter)
- expect(RegistrarPresenter).to receive(:new).and_return(registrar_presenter)
- expect(RegistrantPresenter).to receive(:new).and_return(registrant_presenter)
- end
-
- it 'has sender' do
- expect(message.from).to eq(['noreply@internet.ee'])
- end
-
- it 'has recipient' do
- expect(domain).to receive(:primary_contact_emails).and_return(['recipient@test.com'])
- expect(message.to).to match_array(['recipient@test.com'])
- end
-
- it 'has valid subject' do
- subject = 'Domeen test.com on kustutusmenetluses' \
- ' / Domain test.com is in deletion process' \
- ' / Домен test.com в процессе удаления'
- expect(message.subject).to eq(subject)
- end
-
- context 'when template is :death' do
- let(:template_name) { 'death' }
-
- it 'sends message' do
- expect { message.deliver_now }.to change { ActionMailer::Base.deliveries.count }.by(1)
- end
- end
-
- context 'when registrant is private entity' do
- let(:registrant) { build_stubbed(:registrant_private_entity) }
-
- it 'sends message' do
- expect { message.deliver_now }.to change { ActionMailer::Base.deliveries.count }.by(1)
- end
- end
-
- context 'when registrant is legal entity' do
- let(:registrant) { build_stubbed(:registrant_legal_entity) }
-
- it 'sends message' do
- expect { message.deliver_now }.to change { ActionMailer::Base.deliveries.count }.by(1)
- end
- end
- end
-end
diff --git a/spec/mailers/domain_expire_mailer_spec.rb b/spec/mailers/domain_expire_mailer_spec.rb
deleted file mode 100644
index e5660c11b9..0000000000
--- a/spec/mailers/domain_expire_mailer_spec.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe DomainExpireMailer do
- describe '#expired' do
- let(:domain) { instance_spy(Domain,
- id: 1,
- name: 'test.com',
- primary_contact_emails: recipient)
- }
- let(:domain_presenter) { instance_spy(DomainPresenter) }
- let(:registrar_presenter) { instance_spy(RegistrarPresenter) }
- subject(:message) { described_class.expired(domain: domain, registrar: nil) }
-
- before :example do
- expect(DomainPresenter).to receive(:new).and_return(domain_presenter)
- expect(RegistrarPresenter).to receive(:new).and_return(registrar_presenter)
- end
-
- context 'when all recipients are valid' do
- let(:recipient) { %w[recipient@test.com recipient@test.com] }
-
- it 'has sender' do
- expect(message.from).to eq(['noreply@internet.ee'])
- end
-
- it 'delivers to all recipients' do
- expect(message.to).to match_array(%w[recipient@test.com recipient@test.com])
- end
-
- it 'has subject' do
- expect(message.subject).to eq('The test.com domain has expired')
- end
-
- it 'logs valid emails' do
- log_message = 'Send DomainExpireMailer#expired email for domain test.com (#1) to recipient@test.com,' \
- ' recipient@test.com'
- expect(described_class.logger).to receive(:info).with(log_message)
- message.deliver_now
- end
-
- it 'sends message' do
- expect { message.deliver_now }.to change { ActionMailer::Base.deliveries.count }.by(1)
- end
- end
-
- context 'when some recipient is invalid' do
- let(:recipient) { %w[invalid_email valid@test.com] }
-
- before :example do
- allow(described_class.logger).to receive(:info)
- end
-
- it 'does not deliver to invalid recipient' do
- expect(message.to).to match_array(%w[valid@test.com])
- end
-
- it 'does not log invalid email in success message' do
- log_message = 'Send DomainExpireMailer#expired email for domain test.com (#1) to valid@test.com'
- expect(described_class.logger).to receive(:info).with(log_message)
- message.deliver_now
- end
-
- it 'logs invalid email in error message' do
- log_message = 'Unable to send DomainExpireMailer#expired email for domain test.com (#1) to' \
- ' invalid recipient invalid_email'
- expect(described_class.logger).to receive(:info).with(log_message)
- message.deliver_now
- end
- end
- end
-end
diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb
index 875042a279..5913083c93 100644
--- a/spec/models/contact_spec.rb
+++ b/spec/models/contact_spec.rb
@@ -240,16 +240,6 @@
RSpec.describe Contact do
it { is_expected.to alias_attribute(:kind, :ident_type) }
- describe '::names' do
- before :example do
- expect(described_class).to receive(:pluck).with(:name).and_return('names')
- end
-
- it 'returns names' do
- expect(described_class.names).to eq('names')
- end
- end
-
describe '::emails' do
before :example do
expect(described_class).to receive(:pluck).with(:email).and_return('emails')
diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb
index 075f9ea027..bed293474c 100644
--- a/spec/models/domain_spec.rb
+++ b/spec/models/domain_spec.rb
@@ -696,70 +696,6 @@
end
end
- describe '#admin_contact_names' do
- let(:domain) { described_class.new }
-
- before :example do
- expect(Contact).to receive(:names).and_return('names')
- end
-
- it 'returns admin contact names' do
- expect(domain.admin_contact_names).to eq('names')
- end
- end
-
- describe '#admin_contact_emails' do
- let(:domain) { described_class.new }
-
- before :example do
- expect(Contact).to receive(:emails).and_return('emails')
- end
-
- it 'returns admin contact emails' do
- expect(domain.admin_contact_emails).to eq('emails')
- end
- end
-
- describe '#tech_contact_names' do
- let(:domain) { described_class.new }
-
- before :example do
- expect(Contact).to receive(:names).and_return('names')
- end
-
- it 'returns technical contact names' do
- expect(domain.tech_contact_names).to eq('names')
- end
- end
-
- describe '#nameserver_hostnames' do
- let(:domain) { described_class.new }
-
- before :example do
- expect(Nameserver).to receive(:hostnames).and_return('hostnames')
- end
-
- it 'returns name server hostnames' do
- expect(domain.nameserver_hostnames).to eq('hostnames')
- end
- end
-
- describe '#primary_contact_emails' do
- let(:domain) { described_class.new }
-
- before :example do
- expect(domain).to receive(:registrant_email).and_return('registrant@test.com')
- expect(domain).to receive(:admin_contact_emails).and_return(%w(admin.contact@test.com admin.contact@test.com))
- end
-
- it 'returns unique list of registrant and administrative contact emails' do
- expect(domain.primary_contact_emails).to match_array(%w(
- registrant@test.com
- admin.contact@test.com
- ))
- end
- end
-
describe '#set_graceful_expired' do
let(:domain) { described_class.new }
diff --git a/spec/presenters/domain_presenter_spec.rb b/spec/presenters/domain_presenter_spec.rb
index 0b475d6fdf..410c41e2e2 100644
--- a/spec/presenters/domain_presenter_spec.rb
+++ b/spec/presenters/domain_presenter_spec.rb
@@ -78,42 +78,6 @@
end
end
- describe '#admin_contact_names' do
- let(:domain) { instance_double(Domain) }
-
- before :example do
- expect(domain).to receive(:admin_contact_names).and_return(%w(test1 test2 test3))
- end
-
- it 'returns admin contact names' do
- expect(presenter.admin_contact_names).to eq('test1, test2, test3')
- end
- end
-
- describe '#tech_contact_names' do
- let(:domain) { instance_double(Domain) }
-
- before :example do
- expect(domain).to receive(:tech_contact_names).and_return(%w(test1 test2 test3))
- end
-
- it 'returns technical contact names' do
- expect(presenter.tech_contact_names).to eq('test1, test2, test3')
- end
- end
-
- describe '#nameserver_names' do
- let(:domain) { instance_double(Domain) }
-
- before :example do
- expect(domain).to receive(:nameserver_hostnames).and_return(%w(test1 test2 test3))
- end
-
- it 'returns nameserver names' do
- expect(presenter.nameserver_names).to eq('test1, test2, test3')
- end
- end
-
domain_delegatable_attributes = %i(
name
transfer_code
diff --git a/spec/views/mailers/domain_expire_mailer/expired.html.erb_spec.rb b/spec/views/mailers/domain_expire_mailer/expired.html.erb_spec.rb
deleted file mode 100644
index 9e7fb077bd..0000000000
--- a/spec/views/mailers/domain_expire_mailer/expired.html.erb_spec.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'rails_helper'
-require_relative 'expired_shared'
-
-RSpec.describe 'mailers/domain_expire_mailer/expired.html.erb' do
- before :example do
- stub_template 'mailers/shared/registrar/_registrar.et.html' => 'test registrar estonian'
- stub_template 'mailers/shared/registrar/_registrar.en.html' => 'test registrar english'
- stub_template 'mailers/shared/registrar/_registrar.ru.html' => 'test registrar russian'
- end
-
- include_examples 'domain expire mailer expired'
-end
diff --git a/spec/views/mailers/domain_expire_mailer/expired.text.erb_spec.rb b/spec/views/mailers/domain_expire_mailer/expired.text.erb_spec.rb
deleted file mode 100644
index c842acf154..0000000000
--- a/spec/views/mailers/domain_expire_mailer/expired.text.erb_spec.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require 'rails_helper'
-require_relative 'expired_shared'
-
-RSpec.describe 'mailers/domain_expire_mailer/expired.text.erb' do
- before :example do
- stub_template 'mailers/shared/registrar/_registrar.et.text' => 'test registrar estonian'
- stub_template 'mailers/shared/registrar/_registrar.en.text' => 'test registrar english'
- stub_template 'mailers/shared/registrar/_registrar.ru.text' => 'test registrar russian'
- end
-
- include_examples 'domain expire mailer expired'
-end
diff --git a/spec/views/mailers/domain_expire_mailer/expired_shared.rb b/spec/views/mailers/domain_expire_mailer/expired_shared.rb
deleted file mode 100644
index 0db36548fc..0000000000
--- a/spec/views/mailers/domain_expire_mailer/expired_shared.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-require 'rails_helper'
-
-RSpec.shared_examples 'domain expire mailer expired' do
- let(:domain) { instance_spy(DomainPresenter) }
- let(:registrar) { instance_spy(RegistrarPresenter) }
- let(:registrant) { instance_spy(RegistrantPresenter) }
- let(:lang_count) { 3 }
-
- before :example do
- assign(:domain, domain)
- assign(:registrar, registrar)
- assign(:registrant, registrant)
- end
-
- it 'has registrar info in estonian' do
- render
- expect(rendered).to have_text('test registrar estonian')
- end
-
- it 'has registrar info in english' do
- render
- expect(rendered).to have_text('test registrar english')
- end
-
- it 'has registrar info in russian' do
- render
- expect(rendered).to have_text('test registrar russian')
- end
-
- it 'has domain name' do
- mention_count = 4 * lang_count
- expect(domain).to receive(:name).exactly(mention_count).times.and_return('test domain name')
- render
- expect(rendered).to have_text('test domain name', count: mention_count)
- end
-
- domain_attributes = %i(
- on_hold_date
- delete_date
- registrant_name
- admin_contact_names
- tech_contact_names
- nameserver_names
- )
-
- domain_attributes.each do |attr_name|
- it "has domain #{attr_name}" do
- expect(domain).to receive(attr_name).exactly(lang_count).times.and_return("test domain #{attr_name}")
- render
- expect(rendered).to have_text("test domain #{attr_name}", count: lang_count)
- end
- end
-end
diff --git a/spec/views/mailers/shared/registrant/_registrant.en.html.erb_spec.rb b/spec/views/mailers/shared/registrant/_registrant.en.html.erb_spec.rb
deleted file mode 100644
index 54f4fef0ef..0000000000
--- a/spec/views/mailers/shared/registrant/_registrant.en.html.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrant_shared'
-
-RSpec.describe 'mailers/shared/registrant/_registrant.en.html.erb' do
- include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.en.html.erb'
-end
diff --git a/spec/views/mailers/shared/registrant/_registrant.en.text.erb_spec.rb b/spec/views/mailers/shared/registrant/_registrant.en.text.erb_spec.rb
deleted file mode 100644
index a66967bb74..0000000000
--- a/spec/views/mailers/shared/registrant/_registrant.en.text.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrant_shared'
-
-RSpec.describe 'mailers/shared/registrant/_registrant.en.text.erb' do
- include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.en.text.erb'
-end
diff --git a/spec/views/mailers/shared/registrant/_registrant.et.html.erb_spec.rb b/spec/views/mailers/shared/registrant/_registrant.et.html.erb_spec.rb
deleted file mode 100644
index f06c43ac3d..0000000000
--- a/spec/views/mailers/shared/registrant/_registrant.et.html.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrant_shared'
-
-RSpec.describe 'mailers/shared/registrant/_registrant.et.html.erb' do
- include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.et.html.erb'
-end
diff --git a/spec/views/mailers/shared/registrant/_registrant.et.text.erb_spec.rb b/spec/views/mailers/shared/registrant/_registrant.et.text.erb_spec.rb
deleted file mode 100644
index 909c6f6be2..0000000000
--- a/spec/views/mailers/shared/registrant/_registrant.et.text.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrant_shared'
-
-RSpec.describe 'mailers/shared/registrant/_registrant.et.text.erb' do
- include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.et.text.erb'
-end
diff --git a/spec/views/mailers/shared/registrant/registrant_shared.rb b/spec/views/mailers/shared/registrant/registrant_shared.rb
deleted file mode 100644
index ff90ceb7eb..0000000000
--- a/spec/views/mailers/shared/registrant/registrant_shared.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-require 'rails_helper'
-
-RSpec.shared_examples 'domain mailer registrant info' do |template_path|
- let(:template_path) { template_path }
- let(:registrant) { instance_spy(RegistrantPresenter) }
-
- before :example do
- without_partial_double_verification do
- allow(view).to receive(:registrant).and_return(registrant)
- allow(view).to receive(:address_processing)
- end
- end
-
- it 'has name' do
- allow(registrant).to receive(:name).and_return('test name')
- render template: template_path
- expect(rendered).to have_text('test name')
- end
-
- it 'has ident' do
- allow(registrant).to receive(:ident).and_return('test ident')
- render template: template_path
- expect(rendered).to have_text('test ident')
- end
-
- context 'when :with_phone is true' do
- it 'has phone' do
- allow(registrant).to receive(:phone).and_return('test phone')
- render template: template_path, locals: { with_phone: true }
- expect(rendered).to have_text('test phone')
- end
- end
-
- context 'when :with_phone is false' do
- it 'has no phone' do
- allow(registrant).to receive(:phone).and_return('test phone')
- render template: template_path, locals: { with_phone: false }
- expect(rendered).to_not have_text('test phone')
- end
- end
-
- address_attributes = %i[street city state zip country]
-
- context 'when address processing is enabled' do
- before :example do
- without_partial_double_verification do
- allow(view).to receive(:address_processing).and_return(true)
- end
- end
-
- address_attributes.each do |attr_name|
- it "has #{attr_name}" do
- allow(registrant).to receive(attr_name).and_return("test #{attr_name}")
- render template: template_path
- expect(rendered).to have_text("test #{attr_name}")
- end
- end
-
- it 'has no ident country' do
- allow(registrant).to receive(:ident_country).and_return('test ident country')
- render template: template_path
- expect(rendered).to_not have_text('test ident country')
- end
- end
-
- context 'when address processing is disabled' do
- before :example do
- without_partial_double_verification do
- allow(view).to receive(:address_processing).and_return(false)
- end
- end
-
- address_attributes.each do |attr_name|
- it "has no #{attr_name}" do
- allow(registrant).to receive(attr_name).and_return("test #{attr_name}")
- render template: template_path
- expect(rendered).to_not have_text("test #{attr_name}")
- end
- end
-
- it 'has ident country' do
- allow(registrant).to receive(:ident_country).and_return('test ident country')
- render template: template_path
- expect(rendered).to have_text('test ident country')
- end
- end
-end
diff --git a/spec/views/mailers/shared/registrar/_registrar.en.html.erb_spec.rb b/spec/views/mailers/shared/registrar/_registrar.en.html.erb_spec.rb
deleted file mode 100644
index eddb968dc2..0000000000
--- a/spec/views/mailers/shared/registrar/_registrar.en.html.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrar_shared'
-
-RSpec.describe 'mailers/shared/registrar/_registrar.en.html.erb' do
- include_examples 'domain mailer registrar info'
-end
diff --git a/spec/views/mailers/shared/registrar/_registrar.en.text.erb_spec.rb b/spec/views/mailers/shared/registrar/_registrar.en.text.erb_spec.rb
deleted file mode 100644
index cea5d1d654..0000000000
--- a/spec/views/mailers/shared/registrar/_registrar.en.text.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrar_shared'
-
-RSpec.describe 'mailers/shared/registrar/_registrar.en.text.erb' do
- include_examples 'domain mailer registrar info'
-end
diff --git a/spec/views/mailers/shared/registrar/_registrar.et.html.erb_spec.rb b/spec/views/mailers/shared/registrar/_registrar.et.html.erb_spec.rb
deleted file mode 100644
index d682033062..0000000000
--- a/spec/views/mailers/shared/registrar/_registrar.et.html.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrar_shared'
-
-RSpec.describe 'mailers/shared/registrar/_registrar.et.html.erb' do
- include_examples 'domain mailer registrar info'
-end
diff --git a/spec/views/mailers/shared/registrar/_registrar.et.text.erb_spec.rb b/spec/views/mailers/shared/registrar/_registrar.et.text.erb_spec.rb
deleted file mode 100644
index 230750db39..0000000000
--- a/spec/views/mailers/shared/registrar/_registrar.et.text.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrar_shared'
-
-RSpec.describe 'mailers/shared/registrar/_registrar.et.text.erb' do
- include_examples 'domain mailer registrar info'
-end
diff --git a/spec/views/mailers/shared/registrar/_registrar.ru.html.erb_spec.rb b/spec/views/mailers/shared/registrar/_registrar.ru.html.erb_spec.rb
deleted file mode 100644
index 4cb251ca2e..0000000000
--- a/spec/views/mailers/shared/registrar/_registrar.ru.html.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrar_shared'
-
-RSpec.describe 'mailers/shared/registrar/_registrar.ru.html.erb' do
- include_examples 'domain mailer registrar info'
-end
diff --git a/spec/views/mailers/shared/registrar/_registrar.ru.text.erb_spec.rb b/spec/views/mailers/shared/registrar/_registrar.ru.text.erb_spec.rb
deleted file mode 100644
index e51aba95bf..0000000000
--- a/spec/views/mailers/shared/registrar/_registrar.ru.text.erb_spec.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require 'rails_helper'
-require_relative 'registrar_shared'
-
-RSpec.describe 'mailers/shared/registrar/_registrar.ru.text.erb' do
- include_examples 'domain mailer registrar info'
-end
diff --git a/spec/views/mailers/shared/registrar/registrar_shared.rb b/spec/views/mailers/shared/registrar/registrar_shared.rb
deleted file mode 100644
index 93f228f970..0000000000
--- a/spec/views/mailers/shared/registrar/registrar_shared.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require 'rails_helper'
-
-RSpec.shared_examples 'domain mailer registrar info' do
- let(:registrar) { instance_spy(RegistrarPresenter) }
-
- before :example do
- without_partial_double_verification do
- allow(view).to receive(:registrar).and_return(registrar)
- end
- end
-
- attributes = %i(
- name
- email
- phone
- website
- )
-
- attributes.each do |attr_name|
- it "has #{attr_name}" do
- expect(registrar).to receive(attr_name).and_return("test #{attr_name}")
- render
- expect(rendered).to have_text("test #{attr_name}")
- end
- end
-end
diff --git a/test/mailers/domain_delete_mailer_test.rb b/test/mailers/domain_delete_mailer_test.rb
new file mode 100644
index 0000000000..a7a134fed7
--- /dev/null
+++ b/test/mailers/domain_delete_mailer_test.rb
@@ -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
\ No newline at end of file
diff --git a/test/mailers/domain_expire_mailer_test.rb b/test/mailers/domain_expire_mailer_test.rb
new file mode 100644
index 0000000000..c2185f8f8e
--- /dev/null
+++ b/test/mailers/domain_expire_mailer_test.rb
@@ -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
\ No newline at end of file
diff --git a/test/mailers/previews/domain_delete_mailer_preview.rb b/test/mailers/previews/domain_delete_mailer_preview.rb
new file mode 100644
index 0000000000..12dbbad694
--- /dev/null
+++ b/test/mailers/previews/domain_delete_mailer_preview.rb
@@ -0,0 +1,15 @@
+class DomainDeleteMailerPreview < ActionMailer::Preview
+ def self.define_forced_templates
+ DomainDeleteMailer.force_delete_templates.each do |template_name|
+ define_method "forced_#{template_name}".to_sym do
+ domain = Domain.first
+ DomainDeleteMailer.forced(domain: domain,
+ registrar: domain.registrar,
+ registrant: domain.registrant,
+ template_name: template_name)
+ end
+ end
+ end
+
+ define_forced_templates
+end
\ No newline at end of file
diff --git a/test/mailers/previews/domain_expire_mailer_preview.rb b/test/mailers/previews/domain_expire_mailer_preview.rb
new file mode 100644
index 0000000000..bec206c0fc
--- /dev/null
+++ b/test/mailers/previews/domain_expire_mailer_preview.rb
@@ -0,0 +1,7 @@
+class DomainExpireMailerPreview < ActionMailer::Preview
+ def expired
+ domain = Domain.first
+ DomainExpireMailer.expired(domain: domain,
+ registrar: domain.registrar)
+ end
+end
\ No newline at end of file
diff --git a/test/models/domain_test.rb b/test/models/domain_test.rb
index 7f08f44d14..b990c2addd 100644
--- a/test/models/domain_test.rb
+++ b/test/models/domain_test.rb
@@ -70,4 +70,13 @@ def test_does_not_return_registrant_user_administered_domains_by_technical_conta
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
\ No newline at end of file