From f970cb4b79c6d00ed9b086443e73cc1558bc96a6 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 3 Nov 2014 17:49:11 +0200 Subject: [PATCH] Bump renew xml to epp-xml 0.5.0 --- Gemfile | 2 +- Gemfile.lock | 4 ++-- app/models/epp/epp_domain.rb | 3 ++- spec/epp/domain_spec.rb | 20 +++++++++++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 72210a40a..14966fc54 100644 --- a/Gemfile +++ b/Gemfile @@ -85,7 +85,7 @@ group :development, :test do gem 'epp', '~> 1.4.0' # EPP XMLs - gem 'epp-xml', '~> 0.3.0' + gem 'epp-xml', '~> 0.5.0' # Replacement for fixtures gem 'fabrication', '~> 2.11.3' diff --git a/Gemfile.lock b/Gemfile.lock index ac74083be..29fcbaf66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -93,7 +93,7 @@ GEM epp (1.4.0) hpricot libxml-ruby - epp-xml (0.3.0) + epp-xml (0.5.0) activesupport (~> 4.1) builder (~> 3.2) equalizer (0.0.9) @@ -362,7 +362,7 @@ DEPENDENCIES database_cleaner (~> 1.3.0) devise (~> 3.3.0) epp (~> 1.4.0) - epp-xml (~> 0.3.0) + epp-xml (~> 0.5.0) fabrication (~> 2.11.3) faker (~> 1.3.0) guard (~> 2.6.1) diff --git a/app/models/epp/epp_domain.rb b/app/models/epp/epp_domain.rb index db8665793..c2cc3958d 100644 --- a/app/models/epp/epp_domain.rb +++ b/app/models/epp/epp_domain.rb @@ -22,7 +22,8 @@ class Epp::EppDomain < Domain [:admin_contacts, :out_of_range], [:base, :ds_data_with_key_not_allowed], [:base, :ds_data_not_allowed], - [:base, :key_data_not_allowed] + [:base, :key_data_not_allowed], + [:period, :not_a_number] ], '2004' => [ # Parameter value range error [:nameservers, :out_of_range, diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index ac1022fcc..4d864d9d1 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -682,7 +682,12 @@ describe 'EPP Domain', epp: true do it 'renews a domain' do exp_date = (Date.today + 1.year) - xml = domain_renew_xml(curExpDate: exp_date.to_s) + xml = EppXml::Domain.renew( + name: { value: 'example.ee' }, + curExpDate: { value: exp_date.to_s }, + period: { value: '1', attrs: { unit: 'y' } } + ) + response = epp_request(xml, :xml) ex_date = response[:parsed].css('renData exDate').text name = response[:parsed].css('renData name').text @@ -691,7 +696,11 @@ describe 'EPP Domain', epp: true do end it 'returns an error when given and current exp dates do not match' do - xml = domain_renew_xml(curExpDate: '2016-08-07') + xml = EppXml::Domain.renew( + name: { value: 'example.ee' }, + curExpDate: { value: '2016-08-07' }, + period: { value: '1', attrs: { unit: 'y' } } + ) response = epp_request(xml, :xml) expect(response[:results][0][:result_code]).to eq('2306') @@ -700,7 +709,12 @@ describe 'EPP Domain', epp: true do it 'returns an error when period is invalid' do exp_date = (Date.today + 1.year) - xml = domain_renew_xml(period_value: 4, curExpDate: exp_date.to_s) + + xml = EppXml::Domain.renew( + name: { value: 'example.ee' }, + curExpDate: { value: exp_date.to_s }, + period: { value: '4', attrs: { unit: 'y' } } + ) response = epp_request(xml, :xml) expect(response[:results][0][:result_code]).to eq('2004')