Update "pending_update_request_for_old_registrant" mailer

#180
This commit is contained in:
Artur Beljajev 2016-11-10 01:36:23 +02:00
parent 7e11c3a3dd
commit eac7690345
6 changed files with 41 additions and 35 deletions

View file

@ -1,11 +1,15 @@
class RegistrantPresenter
delegate :name, :ident, :email, :priv?, to: :registrant
delegate :name, :ident, :email, :priv?, :street, :city, to: :registrant
def initialize(registrant:, view:)
@registrant = registrant
@view = view
end
def country
end
private
attr_reader :registrant

View file

@ -19,7 +19,7 @@ Nimi: <%= @registrant.name %><br>
<% end %>
Tänav: <%= @registrant.street %><br>
Linn: <%= @registrant.city %><br>
Riik: <%= @params[:registrant_country] %>
Riik: <%= @registrant.country %>
<br><br>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ei kinnita või tagasi lükka.
<br><br>
@ -46,14 +46,14 @@ Application for changing registrant of your domain <%= @domain.name %> has been
<br><br>
New registrant:<br>
Name: <%= @registrant.name %><br>
<% if @params[:registrant_priv] %>
Personal code: <%= @registrant.ident %><br>
<% if @registrant.priv? %>
Personal code: <%= @registrant.ident %><br>
<% else %>
Business Registry code: <%= @registrant.ident %><br>
Business Registry code: <%= @registrant.ident %><br>
<% end %>
Street: <%= @params[:registrant_street] %><br>
City: <%= @params[:registrant_city] %><br>
Country: <%= @params[:registrant_country] %>
Street: <%= @registrant.street %><br>
City: <%= @registrant.city %><br>
Country: <%= @registrant.country %>
<br><br>
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
<br><br>

View file

@ -16,7 +16,7 @@ Nimi: <%= @registrant.name %>
<% end %>
Tänav: <%= @registrant.street %>
Linn: <%= @registrant.city %>
Riik: <%= @params[:registrant_country] %>
Riik: <%= @registrant.country %>
Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ei kinnita või tagasi lükka.
Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
@ -38,14 +38,14 @@ Website: <%= @registrar.url %>
New registrant:
Name: <%= @registrant.name %>
<% if @params[:registrant_priv] %>
<% if @registrant.priv? %>
Personal code: <%= @registrant.ident %>
<% else %>
Business Registry code: <%= @registrant.ident %>
<% end %>
Street: <%= @params[:registrant_street] %>
City: <%= @params[:registrant_city] %>
Country: <%= @params[:registrant_country] %>
Street: <%= @registrant.street %>
City: <%= @registrant.city %>
Country: <%= @registrant.country %>
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.
To confirm the update please visit this website, once again review the data and press approve:

View file

@ -4,31 +4,27 @@ RSpec.describe RegistrantPresenter do
let(:registrant) { instance_double(Registrant) }
let(:presenter) { described_class.new(registrant: registrant, view: view) }
describe '#name' do
it 'returns name' do
expect(registrant).to receive(:name).and_return('test name')
expect(presenter.name).to eq('test name')
registrant_delegate_attributes = %i(
name
ident
email
priv?
street
city
)
registrant_delegate_attributes.each do |attribute_name|
describe "##{attribute_name}" do
it 'delegetes to registrant' do
expect(registrant).to receive(attribute_name).and_return('test')
expect(presenter.send(attribute_name)).to eq('test')
end
end
end
describe '#ident' do
it 'returns ident' do
expect(registrant).to receive(:ident).and_return('test ident')
expect(presenter.ident).to eq('test ident')
end
end
describe '#email' do
it 'returns email' do
expect(registrant).to receive(:email).and_return('test email')
expect(presenter.email).to eq('test email')
end
end
describe '#priv?' do
it 'delegates to registrant' do
expect(registrant).to receive(:priv?).and_return('test')
expect(presenter.priv?).to eq('test')
describe '#country' do
it 'returns country name' do
expect(presenter.country).to be_nil
end
end
end

View file

@ -49,6 +49,9 @@ RSpec.describe 'mailers/domain_mailer/pending_update_request_for_old_registrant.
registrant_attributes = %i(
name
ident
street
city
country
)
registrant_attributes.each do |attr_name|

View file

@ -49,6 +49,9 @@ RSpec.describe 'mailers/domain_mailer/pending_update_request_for_old_registrant.
registrant_attributes = %i(
name
ident
street
city
country
)
registrant_attributes.each do |attr_name|