Add auth info to CSV domain list in registrar area

#660
This commit is contained in:
Artur Beljajev 2018-01-18 15:07:14 +02:00
parent a9f04f6f0e
commit c41d329f79
5 changed files with 20 additions and 10 deletions

View file

@ -1,5 +1,5 @@
class DomainPresenter
delegate :name, :registrant_name, :registrant_id, :registrant_code, to: :domain
delegate :name, :auth_info, :registrant_name, :registrant_id, :registrant_code, to: :domain
def initialize(domain:, view:)
@domain = domain

View file

@ -19,6 +19,7 @@ class Registrar::DomainListCSVPresenter
def header
columns = %w(
domain_name
auth_info
registrant_name
registrant_code
expire_time
@ -32,9 +33,10 @@ class Registrar::DomainListCSVPresenter
def domain_to_row(domain:)
row = []
row[0] = domain.name
row[1] = domain.registrant_name
row[2] = domain.registrant_code
row[3] = domain.expire_date
row[1] = domain.auth_info
row[2] = domain.registrant_name
row[3] = domain.registrant_code
row[4] = domain.expire_date
row
CSV::Row.new([], row)

View file

@ -7,6 +7,7 @@ en:
transfer_btn: Transfer
csv:
domain_name: Domain
auth_info: Auth info
registrant_name: Registrant name
registrant_code: Registrant code
expire_time: Date of expiry

View file

@ -151,6 +151,7 @@ RSpec.describe DomainPresenter do
domain_delegatable_attributes = %i(
name
auth_info
registrant_name
registrant_id
registrant_code

View file

@ -10,9 +10,10 @@ RSpec.describe Registrar::DomainListCSVPresenter do
it 'is present' do
columns = []
columns[0] = 'Domain'
columns[1] = 'Registrant name'
columns[2] = 'Registrant code'
columns[3] = 'Date of expiry'
columns[1] = 'Auth info'
columns[2] = 'Registrant name'
columns[3] = 'Registrant code'
columns[4] = 'Date of expiry'
columns
expect(header).to eq(columns)
@ -27,19 +28,24 @@ RSpec.describe Registrar::DomainListCSVPresenter do
expect(row[0]).to eq('test name')
end
it 'has domain auth info' do
expect(domain).to receive(:auth_info).and_return('test auth info')
expect(row[1]).to eq('test auth info')
end
it 'has registrant name' do
expect(domain).to receive(:registrant_name).and_return('test registrant name')
expect(row[1]).to eq('test registrant name')
expect(row[2]).to eq('test registrant name')
end
it 'has registrant code' do
expect(domain).to receive(:registrant_code).and_return('test registrant code')
expect(row[2]).to eq('test registrant code')
expect(row[3]).to eq('test registrant code')
end
it 'has expire date' do
expect(domain).to receive(:expire_date).and_return('expire date')
expect(row[3]).to eq('expire date')
expect(row[4]).to eq('expire date')
end
end
end