Refactor domain info request to builder

This commit is contained in:
Martin Lensment 2014-08-14 14:44:58 +03:00
parent 0349e63ccd
commit d747d92d2b
2 changed files with 57 additions and 0 deletions

View file

@ -105,5 +105,43 @@ describe 'EPP Helper', epp: true do
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)
end
it 'creates valid info request' do
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name hosts="all">example.ee</domain:name>
</domain:info>
</info>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
generated = Nokogiri::XML(domain_info_xml).to_s.squish
expect(generated).to eq(expected)
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<info>
<domain:info
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name hosts="sub">one.ee</domain:name>
</domain:info>
</info>
<clTRID>ABC-12345</clTRID>
</command>
</epp>
').to_s.squish
generated = Nokogiri::XML(domain_info_xml(name_value: 'one.ee', name_hosts: 'sub')).to_s.squish
expect(generated).to eq(expected)
end
end
end