This commit is contained in:
Martin Lensment 2015-04-29 12:13:34 +03:00
parent 70aba7d5d1
commit 4c503b6c1a
4 changed files with 21 additions and 8 deletions

View file

@ -70,26 +70,29 @@ describe Nameserver do
it 'should replace hostname ends' do
res = Nameserver.replace_hostname_ends(@api_user.registrar.domains, 'ns.ee', 'test.ee')
res.should == false
res.should == 'replaced_some'
@api_user.registrar.nameservers.where("hostname LIKE '%test.ee'").count.should == 4
@domain_1.nameservers.pluck(:hostname).should include('ns1.ns.ee', 'ns2.ns.ee', 'ns2.test.ee')
@domain_2.nameservers.pluck(:hostname).should include('ns1.test.ee', 'ns2.test.ee', 'ns3.test.ee')
res = Nameserver.replace_hostname_ends(@api_user.registrar.domains, 'test.ee', 'testing.ee')
res.should == true
res.should == 'replaced_all'
@api_user.registrar.nameservers.where("hostname LIKE '%testing.ee'").count.should == 4
@domain_1.nameservers.pluck(:hostname).should include('ns1.ns.ee', 'ns2.ns.ee', 'ns2.testing.ee')
@domain_2.nameservers.pluck(:hostname).should include('ns1.testing.ee', 'ns2.testing.ee', 'ns3.testing.ee')
res = Nameserver.replace_hostname_ends(@api_user.registrar.domains, 'ns.ee', 'test.ee')
res.should == true
res.should == 'replaced_all'
@api_user.registrar.nameservers.where("hostname LIKE '%test.ee'").count.should == 2
@domain_1.nameservers.pluck(:hostname).should include('ns1.test.ee', 'ns2.test.ee', 'ns2.testing.ee')
@domain_2.nameservers.pluck(:hostname).should include('ns1.testing.ee', 'ns2.testing.ee', 'ns3.testing.ee')
@domain_3.nameservers.pluck(:hostname).should include('ns1.ns.ee', 'ns2.ns.ee', 'ns3.test.ee')
res = Nameserver.replace_hostname_ends(@api_user.registrar.domains, 'xcv.ee', 'test.ee')
res.should == 'replaced_none'
end
end
end