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
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
res

View file

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