mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
parent
eada1a66dd
commit
8a831ee92c
30 changed files with 205 additions and 201 deletions
9
app/jobs/domain_delete_confirm_email_job.rb
Normal file
9
app/jobs/domain_delete_confirm_email_job.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class DomainDeleteConfirmEmailJob < Que::Job
|
||||
def run(domain_id)
|
||||
domain = Domain.find(domain_id)
|
||||
|
||||
DomainDeleteMailer.confirm(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant).deliver_now
|
||||
end
|
||||
end
|
9
app/jobs/domain_delete_forced_email_job.rb
Normal file
9
app/jobs/domain_delete_forced_email_job.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class DomainDeleteForcedEmailJob < Que::Job
|
||||
def run(domain_id)
|
||||
domain = Domain.find(domain_id)
|
||||
|
||||
DomainDeleteMailer.forced(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant).deliver_now
|
||||
end
|
||||
end
|
|
@ -1,10 +1,9 @@
|
|||
class DomainExpirationEmailJob < Que::Job
|
||||
class DomainExpireEmailJob < Que::Job
|
||||
def run(domain_id)
|
||||
domain = Domain.find(domain_id)
|
||||
|
||||
return if domain.registered?
|
||||
|
||||
DomainExpireMailer.expired(domain: domain, registrar: domain.registrar).deliver_now
|
||||
destroy
|
||||
end
|
||||
end
|
|
@ -16,8 +16,9 @@ class DomainUpdateConfirmJob < Que::Job
|
|||
domain.clean_pendings!
|
||||
raise_errors!(domain)
|
||||
when RegistrantVerification::REJECTED
|
||||
RegistrantChangeMailer.rejected(domain: domain, registrar: domain.registrar, registrant: domain.registrant)
|
||||
.deliver_now
|
||||
RegistrantChangeMailer.rejected(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant).deliver_now
|
||||
|
||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
||||
domain.clean_pendings_lowlevel
|
||||
|
|
11
app/jobs/registrant_change_confirm_email_job.rb
Normal file
11
app/jobs/registrant_change_confirm_email_job.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class RegistrantChangeConfirmEmailJob < Que::Job
|
||||
def run(domain_id, new_registrant_id)
|
||||
domain = Domain.find(domain_id)
|
||||
new_registrant = Registrant.find(new_registrant_id)
|
||||
|
||||
RegistrantChangeMailer.confirm(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
current_registrant: domain.registrant,
|
||||
new_registrant: new_registrant).deliver_now
|
||||
end
|
||||
end
|
8
app/jobs/registrant_change_expired_email_job.rb
Normal file
8
app/jobs/registrant_change_expired_email_job.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class RegistrantChangeExpiredEmailJob < Que::Job
|
||||
def run(domain_id)
|
||||
domain = Domain.find(domain_id)
|
||||
RegistrantChangeMailer.expired(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
registrant: domain.registrant).deliver_now
|
||||
end
|
||||
end
|
11
app/jobs/registrant_change_notice_email_job.rb
Normal file
11
app/jobs/registrant_change_notice_email_job.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class RegistrantChangeNoticeEmailJob < Que::Job
|
||||
def run(domain_id, new_registrant_id)
|
||||
domain = Domain.find(domain_id)
|
||||
new_registrant = Registrant.find(new_registrant_id)
|
||||
|
||||
RegistrantChangeMailer.notice(domain: domain,
|
||||
registrar: domain.registrar,
|
||||
current_registrant: domain.registrant,
|
||||
new_registrant: new_registrant).deliver_now
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
class DeleteDomainMailer < ApplicationMailer
|
||||
include Que::Mailer
|
||||
|
||||
def pending(domain:, old_registrant:)
|
||||
@domain = DomainPresenter.new(domain: domain, view: view_context)
|
||||
@registrar = RegistrarPresenter.new(registrar: domain.registrar, view: view_context)
|
||||
@verification_url = verification_url(domain)
|
||||
|
||||
subject = default_i18n_subject(domain_name: domain.name)
|
||||
mail(to: old_registrant.email, subject: subject)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def verification_url(domain)
|
||||
registrant_domain_delete_confirm_url(domain, token: domain.registrant_verification_token)
|
||||
end
|
||||
end
|
24
app/mailers/domain_delete_mailer.rb
Normal file
24
app/mailers/domain_delete_mailer.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
class DomainDeleteMailer < ApplicationMailer
|
||||
def confirm(domain:, registrar:, registrant:)
|
||||
@domain = DomainPresenter.new(domain: domain, view: view_context)
|
||||
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
|
||||
@confirm_url = confirm_url(domain)
|
||||
|
||||
subject = default_i18n_subject(domain_name: domain.name)
|
||||
mail(to: registrant.email, subject: subject)
|
||||
end
|
||||
|
||||
def forced(domain:, registrar:, registrant:)
|
||||
@domain = DomainPresenter.new(domain: domain, view: view_context)
|
||||
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
|
||||
@registrant = RegistrantPresenter.new(registrant: registrant, view: view_context)
|
||||
|
||||
mail(to: domain.primary_contact_emails)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def confirm_url(domain)
|
||||
registrant_domain_delete_confirm_url(domain, token: domain.registrant_verification_token)
|
||||
end
|
||||
end
|
|
@ -75,14 +75,6 @@ class DomainMailer < ApplicationMailer
|
|||
name: @domain.name)} [#{@domain.name}]")
|
||||
end
|
||||
|
||||
def force_delete(domain:)
|
||||
@domain = DomainPresenter.new(domain: domain, view: view_context)
|
||||
@registrar = RegistrarPresenter.new(registrar: domain.registrar, view: view_context)
|
||||
@registrant = RegistrantPresenter.new(registrant: domain.registrant, view: view_context)
|
||||
|
||||
mail(to: domain.primary_contact_emails)
|
||||
end
|
||||
|
||||
private
|
||||
# app/models/DomainMailModel provides the data for mail that can be composed_from
|
||||
# which ensures that values of objects are captured when they are valid, not later when this method is executed
|
||||
|
|
|
@ -379,11 +379,8 @@ class Domain < ActiveRecord::Base
|
|||
new_registrant_email = registrant.email
|
||||
new_registrant_name = registrant.name
|
||||
|
||||
current_registrant = Registrant.find(registrant_id_was)
|
||||
RegistrantChangeMailer.confirm(domain: self, registrar: registrar, current_registrant: current_registrant,
|
||||
new_registrant: registrant).deliver
|
||||
RegistrantChangeMailer.notice(domain: self, registrar: registrar, current_registrant: current_registrant,
|
||||
new_registrant: registrant).deliver
|
||||
RegistrantChangeConfirmEmailJob.enqueue(id, new_registrant_id)
|
||||
RegistrantChangeNoticeEmailJob.enqueue(id, new_registrant_id)
|
||||
|
||||
reload
|
||||
|
||||
|
@ -444,8 +441,7 @@ class Domain < ActiveRecord::Base
|
|||
pending_delete_confirmation!
|
||||
save(validate: false) # should check if this did succeed
|
||||
|
||||
old_registrant = Registrant.find(registrant_id_was)
|
||||
DeleteDomainMailer.pending(domain: self, old_registrant: old_registrant).deliver
|
||||
DomainDeleteConfirmEmailJob.enqueue(id)
|
||||
end
|
||||
|
||||
def cancel_pending_delete
|
||||
|
@ -566,12 +562,15 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
self.force_delete_at = (Time.zone.now + (Setting.redemption_grace_period.days + 1.day)).utc.beginning_of_day unless force_delete_at
|
||||
|
||||
transaction do
|
||||
save!(validate: false)
|
||||
registrar.messages.create!(
|
||||
body: I18n.t('force_delete_set_on_domain', domain: name)
|
||||
)
|
||||
DomainMailer.force_delete(domain: self).deliver
|
||||
|
||||
DomainDeleteForcedEmailJob.enqueue(id)
|
||||
|
||||
return true
|
||||
end
|
||||
false
|
||||
|
@ -745,6 +744,10 @@ class Domain < ActiveRecord::Base
|
|||
pending_json['new_registrant_email']
|
||||
end
|
||||
|
||||
def new_registrant_id
|
||||
pending_json['new_registrant_id']
|
||||
end
|
||||
|
||||
def self.to_csv
|
||||
CSV.generate do |csv|
|
||||
csv << column_names
|
||||
|
|
|
@ -16,8 +16,7 @@ class DomainCron
|
|||
end
|
||||
count += 1
|
||||
if domain.pending_update?
|
||||
RegistrantChangeMailer.expired(domain: domain, registrar: domain.registrar, registrant: domain.registrant)
|
||||
.deliver
|
||||
RegistrantChangeExpiredEmailJob.enqueue(domain.id)
|
||||
end
|
||||
if domain.pending_delete? || domain.pending_delete_confirmation?
|
||||
DomainMailer.pending_delete_expired_notification(domain.id, true).deliver
|
||||
|
@ -49,7 +48,7 @@ class DomainCron
|
|||
saved = domain.save(validate: false)
|
||||
|
||||
if saved
|
||||
DomainExpirationEmailJob.enqueue(domain.id, run_at: send_time)
|
||||
DomainExpireEmailJob.enqueue(domain.id, run_at: send_time)
|
||||
marked += 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -571,7 +571,6 @@ class Epp::Domain < Domain
|
|||
frame.css('delete').children.css('delete').attr('verified').to_s.downcase != 'yes'
|
||||
|
||||
registrant_verification_asked!(frame.to_s, user_id)
|
||||
self.deliver_emails = true # turn on email delivery for epp
|
||||
pending_delete!
|
||||
manage_automatic_statuses
|
||||
true # aka 1001 pending_delete
|
||||
|
|
|
@ -8,7 +8,7 @@ Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veen
|
|||
Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan.
|
||||
<br><br>
|
||||
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.<br>
|
||||
<%= link_to @verification_url, @verification_url %>
|
||||
<%= link_to @confirm_url, @confirm_url %>
|
||||
<br><br>
|
||||
Lugupidamisega<br>
|
||||
Eesti Interneti Sihtasutus
|
||||
|
@ -23,7 +23,7 @@ Application for deletion of your domain <%= @domain.name %> has been filed. Plea
|
|||
|
||||
<br><br>
|
||||
To confirm the update please visit this website, once again review the data and press approve:<br>
|
||||
<%= link_to @verification_url, @verification_url %>
|
||||
<%= link_to @confirm_url, @confirm_url %>
|
||||
<br><br>
|
||||
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automatically rejected if it is not approved nor rejected before.
|
||||
<br><br>
|
|
@ -7,7 +7,7 @@ Registrisse laekus taotlus domeeni <%= @domain.name %> kustutamiseks. Palun veen
|
|||
Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan.
|
||||
|
||||
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ise ei kinnita või tagasi lükka.
|
||||
<%= @verification_url %>
|
||||
<%= @confirm_url %>
|
||||
|
||||
Lugupidamisega
|
||||
Eesti Interneti Sihtasutus
|
||||
|
@ -21,7 +21,7 @@ Application for deletion of your domain <%= @domain.name %> has been filed. Plea
|
|||
<%= render 'mailers/shared/registrar/registrar.en.text', registrar: @registrar %>
|
||||
|
||||
To confirm the update please visit this website, once again review the data and press approve:
|
||||
<%= @verification_url %>
|
||||
<%= @confirm_url %>
|
||||
|
||||
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automatically rejected if it is not approved nor rejected before.
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
en:
|
||||
domain_mailer:
|
||||
force_delete:
|
||||
subject: Kustutusmenetluse teade
|
|
@ -1,4 +1,6 @@
|
|||
en:
|
||||
delete_domain_mailer:
|
||||
pending:
|
||||
domain_delete_mailer:
|
||||
confirm:
|
||||
subject: Kinnitustaotlus domeeni %{domain_name} kustutamiseks .ee registrist / Application for approval for deletion of %{domain_name}
|
||||
forced:
|
||||
subject: Kustutusmenetluse teade
|
|
@ -1,6 +1,6 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DomainExpirationEmailJob do
|
||||
RSpec.describe DomainExpireEmailJob do
|
||||
describe '#run' do
|
||||
let(:domain) { instance_double(Domain) }
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DeleteDomainMailer do
|
||||
describe '#pending' do
|
||||
let(:domain) { instance_spy(Domain, name: 'test.com') }
|
||||
let(:old_registrant) { instance_spy(Registrant, email: 'registrant@test.com') }
|
||||
let(:domain_presenter) { instance_spy(DomainPresenter) }
|
||||
let(:registrar_presenter) { instance_spy(RegistrarPresenter) }
|
||||
subject(:message) { described_class.pending(domain: domain, old_registrant: old_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 old registrant 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 confirmation 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! }.to change { ActionMailer::Base.deliveries.count }.by(1)
|
||||
end
|
||||
end
|
||||
end
|
82
spec/mailers/domain_delete_mailer_spec.rb
Normal file
82
spec/mailers/domain_delete_mailer_spec.rb
Normal file
|
@ -0,0 +1,82 @@
|
|||
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! }.to change { ActionMailer::Base.deliveries.count }.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#forced' do
|
||||
let(:domain) { instance_spy(Domain, name: 'test.com') }
|
||||
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')
|
||||
}
|
||||
|
||||
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
|
||||
expect(message.subject).to eq('Kustutusmenetluse teade')
|
||||
end
|
||||
|
||||
it 'sends message' do
|
||||
expect { message.deliver! }.to change { ActionMailer::Base.deliveries.count }.by(1)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,34 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DomainMailer do
|
||||
describe '#force_delete' do
|
||||
let(:domain) { instance_spy(Domain, name: 'test.com') }
|
||||
let(:domain_presenter) { instance_spy(DomainPresenter) }
|
||||
let(:registrar_presenter) { instance_spy(RegistrarPresenter) }
|
||||
let(:registrant_presenter) { instance_spy(RegistrantPresenter) }
|
||||
subject(:message) { described_class.force_delete(domain: domain) }
|
||||
|
||||
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
|
||||
expect(message.subject).to eq('Kustutusmenetluse teade')
|
||||
end
|
||||
|
||||
it 'sends message' do
|
||||
expect { message.deliver! }.to change { ActionMailer::Base.deliveries.count }.by(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -805,26 +805,6 @@ RSpec.describe Domain, db: false do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#pending_delete!' do
|
||||
let(:domain) { described_class.new }
|
||||
let(:old_registrant) { instance_double(Registrant) }
|
||||
let(:message) { instance_double(Mail::Message) }
|
||||
|
||||
before :example do
|
||||
expect(Registrant).to receive(:find).and_return(old_registrant)
|
||||
allow(domain).to receive(:registrant_verification_asked?).and_return(true)
|
||||
allow(domain).to receive(:save)
|
||||
end
|
||||
|
||||
it 'sends notification email' do
|
||||
expect(DeleteDomainMailer).to receive(:pending)
|
||||
.with(domain: domain, old_registrant: old_registrant)
|
||||
.and_return(message)
|
||||
expect(message).to receive(:deliver)
|
||||
domain.pending_delete!
|
||||
end
|
||||
end
|
||||
|
||||
describe '#set_graceful_expired' do
|
||||
let(:domain) { described_class.new }
|
||||
|
||||
|
@ -877,46 +857,6 @@ RSpec.describe Domain, db: false do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#pending_update!', db: false do
|
||||
let(:domain) { described_class.new }
|
||||
let(:current_registrant) { FactoryGirl.build_stubbed(:registrant) }
|
||||
let(:new_registrant) { FactoryGirl.build_stubbed(:registrant) }
|
||||
let(:message) { instance_double(Mail::Message) }
|
||||
|
||||
before :example do
|
||||
expect(Registrant).to receive(:find).and_return(current_registrant)
|
||||
expect(domain).to receive_messages(
|
||||
reload: true,
|
||||
pending_update?: false,
|
||||
registrant_verification_asked?: true,
|
||||
registrar: 'registrar',
|
||||
registrant: new_registrant,
|
||||
manage_automatic_statuses: true
|
||||
)
|
||||
end
|
||||
|
||||
it 'sends confirm and notice emails' do
|
||||
allow(RegistrantChangeMailer).to receive(:notice).and_return(message)
|
||||
expect(RegistrantChangeMailer).to receive(:confirm)
|
||||
.with(
|
||||
domain: domain,
|
||||
registrar: 'registrar',
|
||||
current_registrant: current_registrant,
|
||||
new_registrant: new_registrant)
|
||||
.and_return(message)
|
||||
|
||||
expect(RegistrantChangeMailer).to receive(:notice)
|
||||
.with(
|
||||
domain: domain,
|
||||
registrar: 'registrar',
|
||||
current_registrant: current_registrant,
|
||||
new_registrant: new_registrant)
|
||||
.and_return(message)
|
||||
expect(message).to receive(:deliver).exactly(2).times
|
||||
domain.pending_update!
|
||||
end
|
||||
end
|
||||
|
||||
describe '#new_registrant_email' do
|
||||
let(:domain) { described_class.new(pending_json: { new_registrant_email: 'test@test.com' }) }
|
||||
|
||||
|
@ -924,4 +864,12 @@ RSpec.describe Domain, db: false do
|
|||
expect(domain.new_registrant_email).to eq('test@test.com')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#new_registrant_id' do
|
||||
let(:domain) { described_class.new(pending_json: { new_registrant_id: 1 }) }
|
||||
|
||||
it 'returns new registrant\'s id' do
|
||||
expect(domain.new_registrant_id).to eq(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'pending_shared'
|
||||
require_relative 'confirm_shared'
|
||||
|
||||
RSpec.describe 'mailers/delete_domain_mailer/pending.html.erb' do
|
||||
RSpec.describe 'mailers/domain_delete_mailer/confirm.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'
|
||||
end
|
||||
|
||||
include_examples 'delete domain mailer pending'
|
||||
include_examples 'domain delete mailer confirm'
|
||||
end
|
|
@ -1,11 +1,11 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'pending_shared'
|
||||
require_relative 'confirm_shared'
|
||||
|
||||
RSpec.describe 'mailers/delete_domain_mailer/pending.text.erb' do
|
||||
RSpec.describe 'mailers/domain_delete_mailer/confirm.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'
|
||||
end
|
||||
|
||||
include_examples 'delete domain mailer pending'
|
||||
include_examples 'domain delete mailer confirm'
|
||||
end
|
|
@ -1,13 +1,13 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.shared_examples 'delete domain mailer pending' do
|
||||
RSpec.shared_examples 'domain delete mailer confirm' do
|
||||
let(:domain) { instance_spy(DomainPresenter) }
|
||||
let(:lang_count) { 2 }
|
||||
|
||||
before :example do
|
||||
assign(:domain, domain)
|
||||
assign(:registrar, nil)
|
||||
assign(:verification_url, 'test verification url')
|
||||
assign(:confirm_url, 'test confirm url')
|
||||
end
|
||||
|
||||
it 'has registrar info in estonian' do
|
||||
|
@ -27,9 +27,9 @@ RSpec.shared_examples 'delete domain mailer pending' do
|
|||
expect(rendered).to have_text('test domain name', count: mention_count)
|
||||
end
|
||||
|
||||
it 'has verification url' do
|
||||
it 'has confirm url' do
|
||||
mention_count = 1 * lang_count
|
||||
render
|
||||
expect(rendered).to have_text('test verification url', count: mention_count)
|
||||
expect(rendered).to have_text('test confirm url', count: mention_count)
|
||||
end
|
||||
end
|
|
@ -1,12 +1,12 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'force_delete_shared'
|
||||
require_relative 'forced_shared'
|
||||
|
||||
RSpec.describe 'mailers/domain_mailer/force_delete.html.erb' do
|
||||
RSpec.describe 'mailers/domain_delete_mailer/forced.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 mailer force delete'
|
||||
include_examples 'domain delete mailer forced'
|
||||
end
|
|
@ -1,12 +1,12 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'force_delete_shared'
|
||||
require_relative 'forced_shared'
|
||||
|
||||
RSpec.describe 'mailers/domain_mailer/force_delete.text.erb' do
|
||||
RSpec.describe 'mailers/domain_delete_mailer/forced.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 mailer force delete'
|
||||
include_examples 'domain delete mailer forced'
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.shared_examples 'domain mailer force delete' do
|
||||
RSpec.shared_examples 'domain delete mailer forced' do
|
||||
let(:domain) { instance_spy(DomainPresenter) }
|
||||
let(:registrar) { instance_spy(RegistrarPresenter) }
|
||||
let(:registrant) { instance_spy(RegistrantPresenter) }
|
Loading…
Add table
Add a link
Reference in a new issue