Reason when domain is taken

This commit is contained in:
Martin Lensment 2014-06-30 14:46:04 +03:00
parent d2e30c0c5f
commit 9c08edeb36
2 changed files with 12 additions and 4 deletions

View file

@ -16,7 +16,11 @@ class Domain < ActiveRecord::Base
next next
end end
res << {name: x, avail: Domain.find_by(name: x) ? 0 : 1} if Domain.find_by(name: x)
res << {name: x, avail: 0, reason: 'in use'}
else
res << {name: x, avail: 1}
end
end end
res res

View file

@ -28,9 +28,13 @@ describe 'EPP Domain', epp: true do
Fabricate(:domain, name: 'test.ee') Fabricate(:domain, name: 'test.ee')
response = epp_request('domains/check.xml') response = epp_request('domains/check.xml')
domain = response[:parsed].css('resData chkData cd name').first domain = response[:parsed].css('resData chkData cd').first
expect(domain.text).to eq('test.ee') name = domain.css('name').first
expect(domain[:avail]).to eq('0') reason = domain.css('reason').first
expect(name.text).to eq('test.ee')
expect(name[:avail]).to eq('0')
expect(reason.text).to eq('in use')
end end
it 'checks multiple domains' do it 'checks multiple domains' do