mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Merge pull request #1149 from internetee/improve-registrant-change-mailer
Improve registrant change mailer
This commit is contained in:
commit
c192cc0538
33 changed files with 104 additions and 446 deletions
38
test/mailers/previews/registrant_change_mailer_preview.rb
Normal file
38
test/mailers/previews/registrant_change_mailer_preview.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
class RegistrantChangeMailerPreview < ActionMailer::Preview
|
||||
def initialize
|
||||
@domain = Domain.first
|
||||
@new_registrant = Registrant.where.not(email: nil, country_code: nil).first
|
||||
super
|
||||
end
|
||||
|
||||
def confirmation_request
|
||||
RegistrantChangeMailer.confirmation_request(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
current_registrant: @domain.registrant,
|
||||
new_registrant: @new_registrant)
|
||||
end
|
||||
|
||||
def notification
|
||||
RegistrantChangeMailer.notification(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
current_registrant: @domain.registrant,
|
||||
new_registrant: @new_registrant)
|
||||
end
|
||||
|
||||
def accepted
|
||||
RegistrantChangeMailer.accepted(domain: @domain,
|
||||
old_registrant: @domain.registrar)
|
||||
end
|
||||
|
||||
def rejected
|
||||
RegistrantChangeMailer.rejected(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
registrant: @domain.registrant)
|
||||
end
|
||||
|
||||
def expired
|
||||
RegistrantChangeMailer.expired(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
registrant: @domain.registrant)
|
||||
end
|
||||
end
|
|
@ -12,10 +12,11 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase
|
|||
assert_equal 'shop.test', @domain.name
|
||||
assert_equal 'john@inbox.test', @domain.registrant.email
|
||||
|
||||
email = RegistrantChangeMailer.confirm(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
current_registrant: @domain.registrant,
|
||||
new_registrant: @domain.registrant).deliver_now
|
||||
email = RegistrantChangeMailer.confirmation_request(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
current_registrant: @domain.registrant,
|
||||
new_registrant: @domain.registrant)
|
||||
.deliver_now
|
||||
|
||||
assert_emails 1
|
||||
assert_equal ['john@inbox.test'], email.to
|
||||
|
@ -28,10 +29,10 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase
|
|||
assert_equal 'shop.test', @domain.name
|
||||
assert_equal 'william@inbox.test', new_registrant.email
|
||||
|
||||
email = RegistrantChangeMailer.notice(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
current_registrant: @domain.registrant,
|
||||
new_registrant: new_registrant).deliver_now
|
||||
email = RegistrantChangeMailer.notification(domain: @domain,
|
||||
registrar: @domain.registrar,
|
||||
current_registrant: @domain.registrant,
|
||||
new_registrant: new_registrant).deliver_now
|
||||
|
||||
assert_emails 1
|
||||
assert_equal ['william@inbox.test'], email.to
|
||||
|
@ -45,8 +46,8 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase
|
|||
assert_equal 'john@inbox.test', @domain.registrant.email
|
||||
assert_equal 'william@inbox.test', new_registrant.email
|
||||
|
||||
email = RegistrantChangeMailer.confirmed(domain: @domain,
|
||||
old_registrant: new_registrant).deliver_now
|
||||
email = RegistrantChangeMailer.accepted(domain: @domain,
|
||||
old_registrant: new_registrant).deliver_now
|
||||
|
||||
assert_emails 1
|
||||
assert_equal %w[john@inbox.test william@inbox.test], email.to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue