mirror of
https://github.com/internetee/registry.git
synced 2025-05-22 04:09:52 +02:00
Owner contact validation
This commit is contained in:
parent
4396ec665c
commit
62b3ff6fc7
5 changed files with 45 additions and 34 deletions
|
@ -22,6 +22,9 @@ class Domain < ActiveRecord::Base
|
||||||
validates :name, domain_name: true, uniqueness: { message: I18n.t('errors.messages.epp_domain_taken') }
|
validates :name, domain_name: true, uniqueness: { message: I18n.t('errors.messages.epp_domain_taken') }
|
||||||
validates :name_puny, domain_name: true
|
validates :name_puny, domain_name: true
|
||||||
validates :period, numericality: { only_integer: true, greater_than: 0, less_than: 100 }
|
validates :period, numericality: { only_integer: true, greater_than: 0, less_than: 100 }
|
||||||
|
validates :owner_contact, presence: true
|
||||||
|
# validates :tech_contacts_count
|
||||||
|
# validates :admin_contacts_count
|
||||||
|
|
||||||
def name=(value)
|
def name=(value)
|
||||||
value.strip!
|
value.strip!
|
||||||
|
|
|
@ -39,6 +39,9 @@ en:
|
||||||
attributes:
|
attributes:
|
||||||
name:
|
name:
|
||||||
blank: 'Required parameter missing - name'
|
blank: 'Required parameter missing - name'
|
||||||
|
owner_contact:
|
||||||
|
blank: 'Required parameter missing - owner contact'
|
||||||
|
|
||||||
|
|
||||||
errors:
|
errors:
|
||||||
messages:
|
messages:
|
||||||
|
|
|
@ -6,7 +6,9 @@ describe 'EPP Domain', epp: true do
|
||||||
context 'with valid user' do
|
context 'with valid user' do
|
||||||
before(:each) { Fabricate(:epp_user) }
|
before(:each) { Fabricate(:epp_user) }
|
||||||
|
|
||||||
# incomplete
|
context 'with citizen as an owner' do
|
||||||
|
before(:each) { Fabricate(:contact, code: 'jd1234') }
|
||||||
|
|
||||||
it 'creates a domain' do
|
it 'creates a domain' do
|
||||||
response = epp_request('domains/create.xml')
|
response = epp_request('domains/create.xml')
|
||||||
expect(response[:result_code]).to eq('1000')
|
expect(response[:result_code]).to eq('1000')
|
||||||
|
@ -45,6 +47,7 @@ describe 'EPP Domain', epp: true do
|
||||||
expect(Domain.first.admin_contacts.count).to eq 1
|
expect(Domain.first.admin_contacts.count).to eq 1
|
||||||
expect(Domain.first.owner_contact).to_not be nil
|
expect(Domain.first.owner_contact).to_not be nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'checks a domain' do
|
it 'checks a domain' do
|
||||||
response = epp_request('domains/check.xml')
|
response = epp_request('domains/check.xml')
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Fabricator(:domain) do
|
Fabricator(:domain) do
|
||||||
name { "#{Faker::Internet.domain_word}.ee" }
|
name { "#{Faker::Internet.domain_word}.ee" }
|
||||||
period 1
|
period 1
|
||||||
|
owner_contact(fabricator: :contact)
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,7 +40,8 @@ describe Domain do
|
||||||
|
|
||||||
expect(d.errors.messages).to match_array({
|
expect(d.errors.messages).to match_array({
|
||||||
name: ['Required parameter missing - name'],
|
name: ['Required parameter missing - name'],
|
||||||
period: ['is not a number']
|
period: ['is not a number'],
|
||||||
|
owner_contact: ['Required parameter missing - owner contact']
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue