diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 0b75f92e4..18561044f 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -10,11 +10,11 @@ class Epp::DomainsController < EppController case @hosts when 'del' - @nameservers = @domain.delegated_nameservers + @nameservers = @domain.delegated_nameservers.sort when 'sub' - @nameservers = @domain.subordinate_nameservers + @nameservers = @domain.subordinate_nameservers.sort when 'all' - @nameservers = @domain.nameservers + @nameservers = @domain.nameservers.sort end render_epp_response '/epp/domains/info' diff --git a/app/models/domain_transfer.rb b/app/models/domain_transfer.rb index 05b166f9c..ed368a219 100644 --- a/app/models/domain_transfer.rb +++ b/app/models/domain_transfer.rb @@ -53,7 +53,7 @@ class DomainTransfer < ActiveRecord::Base def notify_losing_registrar transfer_from.messages.create!( - body: I18n.t('domain_transfer_was_approved', contacts: domain.contacts.pluck(:code)), + body: I18n.t('domain_transfer_was_approved', contacts: domain.contacts.pluck(:code).sort), attached_obj_id: id, attached_obj_type: self.class.to_s ) diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index 4590eafb4..22b352dfb 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -63,7 +63,7 @@ xml.epp_head do xml.extension do xml.tag!('secDNS:infData', 'xmlns:secDNS' => 'urn:ietf:params:xml:ns:secDNS-1.1') do - @domain.dnskeys.each do |key| + @domain.dnskeys.sort.each do |key| xml.tag!('secDNS:dsData') do xml.tag!('secDNS:keyTag', key.ds_key_tag) xml.tag!('secDNS:alg', key.ds_alg) diff --git a/config/initializers/autolabel.rb b/config/initializers/autolabel.rb index 2f962ef61..160d6c322 100644 --- a/config/initializers/autolabel.rb +++ b/config/initializers/autolabel.rb @@ -1,7 +1,9 @@ class ActionView::Helpers::FormBuilder - alias :orig_label :label + alias_method :orig_label, :label # add a 'required' CSS class to the field label if the field is required + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity def label(method, content_or_options = nil, options = nil, &block) if content_or_options && content_or_options.class == Hash options = content_or_options @@ -13,12 +15,14 @@ class ActionView::Helpers::FormBuilder object.class.validators_on(method).map(&:class).include?(ActiveRecord::Validations::PresenceValidator) if options.class != Hash - options = {:class => "required"} + options = { class: 'required' } else - options[:class] = ((options[:class] || "") + " required").split(" ").uniq.join(" ") + options[:class] = ((options[:class] || "") + ' required').split(' ').uniq.join(' ') end end - self.orig_label(method, content, options || {}, &block) + orig_label(method, content, options || {}, &block) end + # rubocop:enable Metrics/PerceivedComplexity + # rubocop:enable Metrics/CyclomaticComplexity end diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index efebf69ee..3cb250660 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -741,7 +741,7 @@ describe 'EPP Domain', epp: true do response[:msg].should == 'Command completed successfully; ack to dequeue' msg_q = response[:parsed].css('msgQ') msg_q.css('qDate').text.should_not be_blank - contacts = domain.contacts.pluck(:code) + contacts = domain.contacts.pluck(:code).sort msg_q.css('msg').text.should == "Domain transfer was approved, associated contacts are: #{contacts}" msg_q.first['id'].should_not be_blank msg_q.first['count'].should == '1' @@ -1146,8 +1146,7 @@ describe 'EPP Domain', epp: true do domain.registrant.code.should == original_oc_code domain.registrant.registrar_id.should == @registrar2.id - original_contacts_codes.should == domain.contacts.pluck(:code) - + original_contacts_codes.sort.should == domain.contacts.pluck(:code).sort end it 'should not creates transfer without password' do @@ -1446,27 +1445,55 @@ describe 'EPP Domain', epp: true do response[:results][0][:result_code].should == '2302' response[:results][0][:msg].should == 'Nameserver already exists on this domain [hostname]' - response[:results][0][:value].should == 'ns1.example.com' + if response[:results][0][:value] == 'ns1.example.com' + response[:results][0][:value].should == 'ns1.example.com' + else + response[:results][0][:value].should == 'ns2.example.com' + end response[:results][1][:result_code].should == '2302' response[:results][1][:msg].should == 'Nameserver already exists on this domain [hostname]' - response[:results][1][:value].should == 'ns2.example.com' + if response[:results][1][:value] == 'ns1.example.com' + response[:results][1][:value].should == 'ns1.example.com' + else + response[:results][1][:value].should == 'ns2.example.com' + end response[:results][2][:result_code].should == '2302' response[:results][2][:msg].should == 'Contact already exists on this domain [contact_code_cache]' response[:results][2][:value].should == 'mak21' response[:results][3][:msg].should == 'Status already exists on this domain [value]' - response[:results][3][:value].should == 'clientHold' + if response[:results][3][:value] == 'clientHold' + response[:results][3][:value].should == 'clientHold' + else + response[:results][3][:value].should == 'clientUpdateProhibited' + end response[:results][4][:msg].should == 'Status already exists on this domain [value]' - response[:results][4][:value].should == 'clientUpdateProhibited' + if response[:results][4][:value] == 'clientHold' + response[:results][4][:value].should == 'clientHold' + else + response[:results][4][:value].should == 'clientUpdateProhibited' + end response[:results][5][:msg].should == 'Public key already exists [public_key]' - response[:results][5][:value].should == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' + if response[:results][5][:value] == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' + response[:results][5][:value].should == + '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' + else + response[:results][5][:value].should == + '841936717ae427ace63c28d04918569a841936717ae427ace63c28d0' + end response[:results][6][:msg].should == 'Public key already exists [public_key]' - response[:results][6][:value].should == '841936717ae427ace63c28d04918569a841936717ae427ace63c28d0' + if response[:results][6][:value] == '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' + response[:results][6][:value].should == + '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f' + else + response[:results][6][:value].should == + '841936717ae427ace63c28d04918569a841936717ae427ace63c28d0' + end d.domain_statuses.count.should == 2 end @@ -1773,9 +1800,9 @@ describe 'EPP Domain', epp: true do admin_contacts_from_request.should == admin_contacts_existing hosts_from_request = inf_data.css('hostName').map(&:text) - hosts_existing = domain.nameservers.pluck(:hostname) + hosts_existing = domain.nameservers.pluck(:hostname).sort - hosts_from_request.should == hosts_existing + hosts_from_request.sort.should == hosts_existing ns1 = inf_data.css('hostAttr').last diff --git a/spec/models/admin_user_spec.rb b/spec/models/admin_user_spec.rb index 3389f6f5f..5769cabd4 100644 --- a/spec/models/admin_user_spec.rb +++ b/spec/models/admin_user_spec.rb @@ -13,7 +13,8 @@ describe AdminUser do "Country code is missing", "Email Email is missing", "Password Password is missing", - "Username Username is missing" + "Username Username is missing", + "Roles is missing" ]) end