diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb
index e2e722d9a..27fcbbd88 100644
--- a/spec/epp/domain_spec.rb
+++ b/spec/epp/domain_spec.rb
@@ -179,13 +179,17 @@ describe 'EPP Domain', epp: true do
end
it 'returns an error when given and current exp dates do not match' do
- response = epp_request('domains/renew_w_not_matching_exp_dates.xml')
+ xml = domain_renew_xml(curExpDate: '2016-08-07')
+
+ response = epp_request(xml, :xml)
expect(response[:results][0][:result_code]).to eq('2306')
expect(response[:results][0][:msg]).to eq('Given and current expire dates do not match')
end
- it 'returns an error when given and current exp dates do not match' do
- response = epp_request('domains/renew_w_invalid_period.xml')
+ it 'returns an error when period is invalid' do
+ xml = domain_renew_xml(period_value: 4)
+
+ response = epp_request(xml, :xml)
expect(response[:results][0][:result_code]).to eq('2004')
expect(response[:results][0][:msg]).to eq('Period must add up to 1, 2 or 3 years')
expect(response[:results][0][:value]).to eq('4')
diff --git a/spec/epp/requests/domains/renew_w_invalid_period.xml b/spec/epp/requests/domains/renew_w_invalid_period.xml
deleted file mode 100644
index 75300b857..000000000
--- a/spec/epp/requests/domains/renew_w_invalid_period.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
- example.ee
- 2014-08-07
- 4
-
-
- ABC-12345
-
-
diff --git a/spec/epp/requests/domains/renew_w_not_matching_exp_dates.xml b/spec/epp/requests/domains/renew_w_not_matching_exp_dates.xml
deleted file mode 100644
index cfb9f5041..000000000
--- a/spec/epp/requests/domains/renew_w_not_matching_exp_dates.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
- example.ee
- 2016-08-07
- 1
-
-
- ABC-12345
-
-
diff --git a/spec/support/epp.rb b/spec/support/epp.rb
index d33cfa400..b044bd4ac 100644
--- a/spec/support/epp.rb
+++ b/spec/support/epp.rb
@@ -63,7 +63,7 @@ module Epp
xml.create do
xml.tag!('domain:create', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
- xml.tag!('domain:name', (xml_params[:name] || 'expample.ee')) if xml_params[:name] != false
+ xml.tag!('domain:name', (xml_params[:name] || 'example.ee')) if xml_params[:name] != false
xml.tag!('domain:period', (xml_params[:period_value] || 1), 'unit' => (xml_params[:period_unit] || 'y')) if xml_params[:period] != false
@@ -89,6 +89,24 @@ module Epp
end
end
+ def domain_renew_xml(xml_params={})
+ 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.renew do
+ xml.tag!('domain:renew', 'xmlns:domain' => 'urn:ietf:params:xml:ns:domain-1.0') do
+ xml.tag!('domain:name', (xml_params[:name] || 'example.ee')) if xml_params[:name] != false
+ xml.tag!('domain:curExpDate', (xml_params[:curExpDate] || '2014-08-07')) if xml_params[:curExpDate] != false
+ xml.tag!('domain:period', (xml_params[:period_value] || 1), 'unit' => (xml_params[:period_unit] || 'y')) if xml_params[:period] != false
+ end
+ end
+ xml.clTRID 'ABC-12345'
+ end
+ end
+ end
+
end
RSpec.configure do |c|