Merge remote-tracking branch 'origin/registry-660' into registry-661

# Conflicts:
#	db/structure.sql
#	doc/repp-doc.md
This commit is contained in:
Artur Beljajev 2018-01-30 00:58:49 +02:00
commit 56e3f236bc
156 changed files with 2085 additions and 1276 deletions

View file

@ -63,7 +63,7 @@ RSpec.describe Contact do
context 'with valid attributes' do
before :example do
@contact = create(:contact, auth_info: 'password')
@contact = create(:contact)
end
it 'should have one version' do
@ -87,10 +87,6 @@ RSpec.describe Contact do
@contact.code.should == old_code
end
it 'should have static password' do
@contact.auth_info.should == 'password'
end
it 'should have ok status by default' do
@contact.statuses.should == %w(ok)
end
@ -171,36 +167,22 @@ RSpec.describe Contact do
end
context 'with callbacks' do
before :example do
# Ensure callbacks are not taken out from other specs
Contact.set_callback(:create, :before, :generate_auth_info)
end
context 'after create' do
it 'should not allow to use same code' do
registrar = create(:registrar, code: 'FIXED')
create(:contact,
registrar: registrar,
code: 'FIXED:new-code',
auth_info: 'qwe321')
code: 'FIXED:new-code')
@contact = build(:contact,
registrar: registrar,
code: 'FIXED:new-code',
auth_info: 'qwe321')
code: 'FIXED:new-code')
@contact.validate
expect(@contact.errors).to have_key(:code)
end
it 'should generate a new password' do
@contact = build(:contact, code: '123asd', auth_info: nil)
@contact.auth_info.should == nil
@contact.save.should == true
@contact.auth_info.should_not be_nil
end
it 'should allow supported code format' do
@contact = build(:contact, code: 'CID:REG1:12345', registrar: create(:registrar, code: 'FIXED'))
@contact.valid?
@ -227,29 +209,6 @@ RSpec.describe Contact do
@contact.code.should =~ /FIXED:..../
end
end
context 'after update' do
before :example do
@contact = build(:contact,
registrar: create(:registrar, code: 'FIXED'),
code: '123asd',
auth_info: 'qwe321')
@contact.generate_code
@contact.save
@contact.code.should == 'FIXED:123ASD'
@auth_info = @contact.auth_info
end
it 'should not generate new code' do
@contact.update_attributes(name: 'qevciherot23')
@contact.code.should == 'FIXED:123ASD'
end
it 'should not generate new auth_info' do
@contact.update_attributes(name: 'fvrsgbqevciherot23')
@contact.auth_info.should == @auth_info
end
end
end
end
end

View file

@ -538,11 +538,6 @@ RSpec.describe Domain do
expect(domain.errors[:base]).to include('Required parameter missing; reserved>pw element required for reserved domains')
end
it 'generates auth info' do
d = create(:domain)
expect(d.auth_info).to_not be_empty
end
it 'manages statuses automatically' do
d = build(:domain)

View file

@ -1,69 +0,0 @@
require 'rails_helper'
describe DomainTransfer do
before :example do
Setting.ds_algorithm = 2
Setting.ds_data_allowed = true
Setting.ds_data_with_key_allowed = true
Setting.key_data_allowed = true
Setting.dnskeys_min_count = 0
Setting.dnskeys_max_count = 9
Setting.ns_min_count = 2
Setting.ns_max_count = 11
Setting.transfer_wait_time = 0
Setting.admin_contacts_min_count = 1
Setting.admin_contacts_max_count = 10
Setting.tech_contacts_min_count = 0
Setting.tech_contacts_max_count = 10
Setting.client_side_status_editing_enabled = true
create(:zone, origin: 'ee')
end
context 'with invalid attribute' do
before :example do
@domain_transfer = DomainTransfer.new
end
it 'should not be valid' do
@domain_transfer.valid?
@domain_transfer.errors.full_messages.should match_array([
])
end
it 'should not have any versions' do
@domain_transfer.versions.should == []
end
end
context 'with valid attributes' do
before :example do
@domain_transfer = create(:domain_transfer)
end
it 'should be valid' do
@domain_transfer.valid?
@domain_transfer.errors.full_messages.should match_array([])
end
it 'should be valid twice' do
@domain_transfer = create(:domain_transfer)
@domain_transfer.valid?
@domain_transfer.errors.full_messages.should match_array([])
end
it 'should have one version' do
with_versioning do
@domain_transfer.versions.should == []
@domain_transfer.wait_until = 1.day.since
@domain_transfer.save
@domain_transfer.errors.full_messages.should match_array([])
@domain_transfer.versions.size.should == 1
end
end
end
end