mirror of
https://github.com/internetee/registry.git
synced 2025-07-02 01:03:35 +02:00
parent
28b76a6d91
commit
435e1d5d64
1 changed files with 3 additions and 39 deletions
|
@ -63,7 +63,7 @@ RSpec.describe Contact do
|
||||||
|
|
||||||
context 'with valid attributes' do
|
context 'with valid attributes' do
|
||||||
before :example do
|
before :example do
|
||||||
@contact = create(:contact, auth_info: 'password')
|
@contact = create(:contact)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have one version' do
|
it 'should have one version' do
|
||||||
|
@ -87,10 +87,6 @@ RSpec.describe Contact do
|
||||||
@contact.code.should == old_code
|
@contact.code.should == old_code
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have static password' do
|
|
||||||
@contact.auth_info.should == 'password'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should have ok status by default' do
|
it 'should have ok status by default' do
|
||||||
@contact.statuses.should == %w(ok)
|
@contact.statuses.should == %w(ok)
|
||||||
end
|
end
|
||||||
|
@ -177,25 +173,16 @@ RSpec.describe Contact do
|
||||||
|
|
||||||
create(:contact,
|
create(:contact,
|
||||||
registrar: registrar,
|
registrar: registrar,
|
||||||
code: 'FIXED:new-code',
|
code: 'FIXED:new-code')
|
||||||
auth_info: 'qwe321')
|
|
||||||
@contact = build(:contact,
|
@contact = build(:contact,
|
||||||
registrar: registrar,
|
registrar: registrar,
|
||||||
code: 'FIXED:new-code',
|
code: 'FIXED:new-code')
|
||||||
auth_info: 'qwe321')
|
|
||||||
|
|
||||||
@contact.validate
|
@contact.validate
|
||||||
|
|
||||||
expect(@contact.errors).to have_key(:code)
|
expect(@contact.errors).to have_key(:code)
|
||||||
end
|
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
|
it 'should allow supported code format' do
|
||||||
@contact = build(:contact, code: 'CID:REG1:12345', registrar: create(:registrar, code: 'FIXED'))
|
@contact = build(:contact, code: 'CID:REG1:12345', registrar: create(:registrar, code: 'FIXED'))
|
||||||
@contact.valid?
|
@contact.valid?
|
||||||
|
@ -222,29 +209,6 @@ RSpec.describe Contact do
|
||||||
@contact.code.should =~ /FIXED:..../
|
@contact.code.should =~ /FIXED:..../
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue