Update spec and iron out spec order issue

This commit is contained in:
Priit Tark 2015-04-21 11:33:51 +03:00
parent b51310062d
commit 16b321c52f
6 changed files with 53 additions and 21 deletions

View file

@ -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'

View file

@ -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
)

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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