Domain name presence validation

This commit is contained in:
Martin Lensment 2014-07-30 14:54:21 +03:00
parent bfb9abea8c
commit 8882c36053
5 changed files with 19 additions and 7 deletions

View file

@ -31,10 +31,6 @@ describe 'EPP Domain', epp: true do
expect(response[:clTRID]).to eq('ABC-12345')
end
it 'does not create a domain with false period' do
end
it 'checks a domain' do
response = epp_request('domains/check.xml')
expect(response[:result_code]).to eq('1000')

View file

@ -7,7 +7,7 @@ describe Domain do
it { should belong_to(:owner_contact) }
it { should belong_to(:technical_contact) }
it 'creates a resource' do
it 'validates domain name' do
d = Fabricate(:domain)
expect(d.name).to_not be_nil
@ -34,6 +34,14 @@ describe Domain do
valid_punycode.each do |x|
expect(Fabricate.build(:domain, name: x).valid?).to be true
end
d = Domain.new
expect(d.valid?).to be false
expect(d.errors.messages).to match_array({
name: ['Required parameter missing - name'],
period: ['is not a number']
})
end
it 'does not create a reserved domain' do
@ -46,4 +54,5 @@ describe Domain do
expect(Fabricate.build(:domain, period: 120).valid?).to be false
expect(Fabricate.build(:domain, period: 99).valid?).to be true
end
end