From 7a9988236e3deeb46ad0dcae86ca609ddf47e34b Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Thu, 31 Jul 2014 11:01:08 +0300 Subject: [PATCH] Add owner contact --- app/helpers/epp/domains_helper.rb | 3 ++- spec/epp/domain_spec.rb | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/epp/domains_helper.rb b/app/helpers/epp/domains_helper.rb index eab7284f2..5958d46a8 100644 --- a/app/helpers/epp/domains_helper.rb +++ b/app/helpers/epp/domains_helper.rb @@ -29,7 +29,8 @@ module Epp::DomainsHelper period: ph[:period].to_i, valid_from: Date.today, valid_to: Date.today + ph[:period].to_i.years, - auth_info: ph[:authInfo][:pw] + auth_info: ph[:authInfo][:pw], + owner_contact_id: Contact.find_by(code: ph[:registrant]).try(:id) } end diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 2255eca9b..822004ad9 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -32,6 +32,7 @@ describe 'EPP Domain', epp: true do end it 'creates a domain with contacts' do + Fabricate(:contact, code: 'jd1234') Fabricate(:contact, code: 'sh8013') Fabricate(:contact, code: 'sh801333') @@ -42,6 +43,7 @@ describe 'EPP Domain', epp: true do expect(Domain.first.tech_contacts.count).to eq 2 expect(Domain.first.admin_contacts.count).to eq 1 + expect(Domain.first.owner_contact).to_not be nil end it 'checks a domain' do