mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 17:55:55 +02:00
parent
a6de3761c5
commit
2c3dbc6e32
31 changed files with 361 additions and 153 deletions
|
@ -891,4 +891,52 @@ RSpec.describe Domain, db: false do
|
|||
expect(described_class.delete_candidates.ids).to eq([1])
|
||||
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' }) }
|
||||
|
||||
it 'returns new registrant\'s email' do
|
||||
expect(domain.new_registrant_email).to eq('test@test.com')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue