mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Support for disclosure settings. Tests
This commit is contained in:
parent
64b0481cb2
commit
4e5aecb26d
7 changed files with 119 additions and 21 deletions
|
@ -18,10 +18,19 @@ describe '.extract_attributes' do
|
|||
|
||||
# TODO: remodel create contact xml to support disclosure
|
||||
it 'should return disclosure has if disclosure' do
|
||||
f = File.open('spec/epp/requests/contacts/create_with_two_addresses.xml')
|
||||
parsed_frame = Nokogiri::XML(f).remove_namespaces!
|
||||
f.close
|
||||
xml = EppXml::Contact.create(
|
||||
{
|
||||
disclose: { value: {
|
||||
voice: { value: '' },
|
||||
addr: { value: '' },
|
||||
name: { value: '' },
|
||||
org_name: { value: '' },
|
||||
email: { value: '' },
|
||||
fax: { value: '' }
|
||||
}, attrs: { flag: '0' }
|
||||
} })
|
||||
parsed_frame = Nokogiri::XML(xml).remove_namespaces!
|
||||
result = ContactDisclosure.extract_attributes(parsed_frame)
|
||||
expect(result).to eq({ phone: '0', email: '0' })
|
||||
expect(result).to eq({ phone: '0', email: '0', fax: '0', address: '0', name: '0', org_name: '0' })
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Contact do
|
||||
before { create_disclosure_settings }
|
||||
it { should have_one(:address) }
|
||||
|
||||
context 'with invalid attribute' do
|
||||
|
@ -32,11 +33,30 @@ describe Contact do
|
|||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before(:each) { @contact = Fabricate(:contact) }
|
||||
before(:each) { @contact = Fabricate(:contact, disclosure: nil) }
|
||||
|
||||
it 'should return true' do
|
||||
expect(@contact.valid?).to be true
|
||||
end
|
||||
|
||||
it 'should have default disclosure' do
|
||||
expect(@contact.disclosure.name).to be true
|
||||
expect(@contact.disclosure.org_name).to be true
|
||||
expect(@contact.disclosure.email).to be true
|
||||
expect(@contact.disclosure.phone).to be false
|
||||
expect(@contact.disclosure.fax).to be false
|
||||
expect(@contact.disclosure.address).to be false
|
||||
end
|
||||
|
||||
it 'should have custom disclosure' do
|
||||
@contact = Fabricate(:contact, disclosure: Fabricate(:contact_disclosure))
|
||||
expect(@contact.disclosure.name).to be true
|
||||
expect(@contact.disclosure.org_name).to be true
|
||||
expect(@contact.disclosure.email).to be true
|
||||
expect(@contact.disclosure.phone).to be true
|
||||
expect(@contact.disclosure.fax).to be true
|
||||
expect(@contact.disclosure.address).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'with callbacks' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue