mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +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
|
||||
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
|
||||
|
@ -177,25 +173,16 @@ RSpec.describe Contact do
|
|||
|
||||
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?
|
||||
|
@ -222,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue