From e7ec64f7f7fbe7f3c811e0a720d7b6c9f15e7347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Wed, 13 Aug 2014 15:33:26 +0300 Subject: [PATCH] Moved contact xml builder into seperate file --- spec/support/epp.rb | 26 --------------------- spec/support/epp_contact_xml_builder.rb | 31 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 26 deletions(-) create mode 100644 spec/support/epp_contact_xml_builder.rb diff --git a/spec/support/epp.rb b/spec/support/epp.rb index 4a7fffd66..d33cfa400 100644 --- a/spec/support/epp.rb +++ b/spec/support/epp.rb @@ -89,32 +89,6 @@ module Epp end end - #contact builders - - def contact_check_xml(xml_params={}) - - xml_params[:ids] = xml_params[:ids] || [ { id: 'check-1234' }, { id: 'check-4321' } ] - - xml = Builder::XmlMarkup.new - - xml.instruct!(:xml, standalone: 'no') - xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do - xml.command do - xml.check do - xml.tag!('contact:check', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do - unless xml_params[:ids] == [false] - xml_params[:ids].each do |x| - xml.tag!('contact:id', x[:id]) - end - end - end - end - xml.clTRID 'ABC-12345' - end - end - end - - end RSpec.configure do |c| diff --git a/spec/support/epp_contact_xml_builder.rb b/spec/support/epp_contact_xml_builder.rb new file mode 100644 index 000000000..c1f71e14e --- /dev/null +++ b/spec/support/epp_contact_xml_builder.rb @@ -0,0 +1,31 @@ +module EppContactXmlBuilder + + def contact_check_xml(xml_params={}) + + xml_params[:ids] = xml_params[:ids] || [ { id: 'check-1234' }, { id: 'check-4321' } ] + + xml = Builder::XmlMarkup.new + + xml.instruct!(:xml, standalone: 'no') + xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0') do + xml.command do + xml.check do + xml.tag!('contact:check', 'xmlns:contact' => 'urn:ietf:params:xml:ns:contact-1.0') do + unless xml_params[:ids] == [false] + xml_params[:ids].each do |x| + xml.tag!('contact:id', x[:id]) + end + end + end + end + xml.clTRID 'ABC-12345' + end + end + end + + +end + +RSpec.configure do |c| + c.include EppContactXmlBuilder +end