mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 17:53:35 +02:00
style fixes
This commit is contained in:
parent
22f753aa6c
commit
0e655bf306
7 changed files with 20 additions and 18 deletions
|
@ -63,10 +63,12 @@ module Epp::Common
|
||||||
epp_errors.empty?
|
epp_errors.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def xml_attrs_array_present?(array_ph, attributes )
|
def xml_attrs_array_present?(array_ph, attributes)
|
||||||
[array_ph].flatten.each do |ph|
|
[array_ph].flatten.each do |ph|
|
||||||
attributes.each do |x|
|
attributes.each do |x|
|
||||||
epp_errors << {code: '2003', msg: I18n.t('errors.messages.required_parameter_missing', key: x.last)} unless has_attribute(ph, x)
|
unless has_attribute(ph, x)
|
||||||
|
epp_errors << { code: '2003', msg: I18n.t('errors.messages.required_parameter_missing', key: x.last) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
epp_errors.empty?
|
epp_errors.empty?
|
||||||
|
|
|
@ -14,10 +14,8 @@ class Address < ActiveRecord::Base
|
||||||
# validates_inclusion_of :type, in: TYPES
|
# validates_inclusion_of :type, in: TYPES
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
def validate_postal_info_types(parsed_frame)
|
def validate_postal_info_types(parsed_frame)
|
||||||
errors, used = [], []
|
errors, used = [], []
|
||||||
|
|
||||||
parsed_frame.css('postalInfo').each do |pi|
|
parsed_frame.css('postalInfo').each do |pi|
|
||||||
attr = pi.attributes['type'].try(:value)
|
attr = pi.attributes['type'].try(:value)
|
||||||
errors << { code: 2003, msg: I18n.t('errors.messages.attr_missing', key: 'type') } and next unless attr
|
errors << { code: 2003, msg: I18n.t('errors.messages.attr_missing', key: 'type') } and next unless attr
|
||||||
|
@ -27,8 +25,7 @@ class Address < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
errors << { code: 2005, msg: I18n.t('errors.messages.repeating_postal_info') } and next if used.include?(attr)
|
errors << { code: 2005, msg: I18n.t('errors.messages.repeating_postal_info') } and next if used.include?(attr)
|
||||||
used << attr
|
used << attr
|
||||||
end
|
end; errors
|
||||||
errors
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_attributes(ah)
|
def extract_attributes(ah)
|
||||||
|
|
|
@ -19,13 +19,13 @@ class EppSession < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def marshal(data)
|
def marshal(data)
|
||||||
::Base64.encode64(Marshal.dump(data)) if data
|
::Base64.encode64(Marshal.dump(data)) if data
|
||||||
end
|
end
|
||||||
|
|
||||||
def unmarshal(data)
|
def unmarshal(data)
|
||||||
return data unless data.is_a? String
|
return data unless data.is_a? String
|
||||||
Marshal.load(::Base64.decode64(data)) if data
|
Marshal.load(::Base64.decode64(data)) if data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,8 @@ describe 'EPP Domain', epp: true do
|
||||||
|
|
||||||
context 'with two epp users' do
|
context 'with two epp users' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
elkdata = Fabricate(:registrar,
|
elkdata = Fabricate(
|
||||||
|
:registrar,
|
||||||
name: 'Elkdata',
|
name: 'Elkdata',
|
||||||
reg_no: '123'
|
reg_no: '123'
|
||||||
)
|
)
|
||||||
|
|
|
@ -222,7 +222,8 @@ describe 'EPP Helper', epp: true do
|
||||||
</epp>
|
</epp>
|
||||||
').to_s.squish
|
').to_s.squish
|
||||||
|
|
||||||
generated = Nokogiri::XML(domain_renew_xml(name: 'one.ee', curExpDate: '2009-11-15', period_value: '365', period_unit: 'd')).to_s.squish
|
generated = Nokogiri::XML(domain_renew_xml(name: 'one.ee', curExpDate: '2009-11-15',
|
||||||
|
period_value: '365', period_unit: 'd')).to_s.squish
|
||||||
expect(generated).to eq(expected)
|
expect(generated).to eq(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,4 +25,3 @@ describe '.extract_attributes' do
|
||||||
expect(result).to eq({ phone: '0', email: '0' })
|
expect(result).to eq({ phone: '0', email: '0' })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,15 @@ describe Domain do
|
||||||
d = Fabricate(:domain)
|
d = Fabricate(:domain)
|
||||||
expect(d.name).to_not be_nil
|
expect(d.name).to_not be_nil
|
||||||
|
|
||||||
invalid = ['a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee', 'test-.ee', 'te--st.ee', 'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.ee']
|
invalid = ['a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee', 'test-.ee', 'te--st.ee',
|
||||||
|
'õ.pri.ee', 'test.com', 'www.ab.ee', 'test.eu', ' .ee', 'a b.ee', 'Ž .ee', 'test.edu.ee']
|
||||||
|
|
||||||
invalid.each do |x|
|
invalid.each do |x|
|
||||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||||
end
|
end
|
||||||
|
|
||||||
valid = ['ab.ee', "#{'a' * 63}.ee", 'te-s-t.ee', 'jäääär.ee', 'päike.pri.ee', 'õigus.com.ee', 'õäöü.fie.ee', 'test.med.ee', 'žä.ee', ' ŽŠ.ee ']
|
valid = ['ab.ee', "#{'a' * 63}.ee", 'te-s-t.ee', 'jäääär.ee', 'päike.pri.ee',
|
||||||
|
'õigus.com.ee', 'õäöü.fie.ee', 'test.med.ee', 'žä.ee', ' ŽŠ.ee ']
|
||||||
|
|
||||||
valid.each do |x|
|
valid.each do |x|
|
||||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue