diff --git a/test/mailers/previews/contact_mailer_preview.rb b/test/mailers/previews/contact_mailer_preview.rb index 1e00ef673..e2da0c899 100644 --- a/test/mailers/previews/contact_mailer_preview.rb +++ b/test/mailers/previews/contact_mailer_preview.rb @@ -6,8 +6,9 @@ class ContactMailerPreview < ActionMailer::Preview EXISTS(SELECT 1 FROM domain_contacts WHERE domain_contacts.contact_id = contacts.id)') - contact = contact.where.not(email: nil, country_code: nil, code: nil).first + contact = contact.where.not(email: nil, country_code: nil, ident_country_code: nil, code: nil) + .take ContactMailer.email_changed(contact: contact, old_email: 'old@inbox.test') end -end \ No newline at end of file +end diff --git a/test/mailers/previews/registrant_change_mailer_preview.rb b/test/mailers/previews/registrant_change_mailer_preview.rb index dec948fe6..ac3dab2a9 100644 --- a/test/mailers/previews/registrant_change_mailer_preview.rb +++ b/test/mailers/previews/registrant_change_mailer_preview.rb @@ -1,7 +1,11 @@ class RegistrantChangeMailerPreview < ActionMailer::Preview def initialize - @domain = Domain.first - @new_registrant = Registrant.where.not(email: nil, country_code: nil).first + @domain = Domain.joins(:registrant).where.not({ contacts: { email: nil, + country_code: nil, + ident_country_code: nil } }).take + @new_registrant = Registrant.where.not(email: nil, + country_code: nil, + ident_country_code: nil).take super end @@ -21,7 +25,7 @@ class RegistrantChangeMailerPreview < ActionMailer::Preview def accepted RegistrantChangeMailer.accepted(domain: @domain, - old_registrant: @domain.registrar) + old_registrant: @domain.registrant) end def rejected @@ -35,4 +39,4 @@ class RegistrantChangeMailerPreview < ActionMailer::Preview registrar: @domain.registrar, registrant: @domain.registrant) end -end \ No newline at end of file +end