Registrant change confirmation logic

This commit is contained in:
Priit Tark 2015-05-13 10:00:52 +03:00
parent 762054e5f1
commit 6c47124a28
15 changed files with 292 additions and 17 deletions

View file

@ -0,0 +1,54 @@
require 'rails_helper'
describe DomainMailer do
describe 'registrant changed notification when delivery turned off' do
before :all do
@registrant = Fabricate(:registrant, email: 'test@example.com')
@domain = Fabricate(:domain, registrant: @registrant)
@mail = DomainMailer.registrant_updated(@domain)
end
it 'should not render email subject' do
@mail.subject.should == nil
end
it 'should not have sender email' do
@mail.from.should == nil
end
it 'should not have reveiver email' do
@mail.to.should == nil
end
it 'should not render body' do
@mail.body.should == ''
end
end
describe 'email changed notification' do
before :all do
@registrant = Fabricate(:registrant, email: 'test@example.com')
@new_registrant = Fabricate(:registrant, email: 'test@example.org')
@domain = Fabricate(:domain, registrant: @registrant)
@domain.deliver_emails = true
@domain.registrant = @new_registrant
@mail = DomainMailer.registrant_updated(@domain)
end
it 'should render email subject' do
@mail.subject.should =~ /Kinnitustaotlus domeeni/
end
it 'should have sender email' do
@mail.from.should == ["noreply@internet.ee"]
end
it 'should send confirm email to old registrant email' do
@mail.to.should == ["test@example.com"]
end
it 'should render body' do
@mail.body.encoded.should =~ /Registrisse laekus taotlus domeeni/
end
end
end