All system now supports legacy CID format

This commit is contained in:
Priit Tark 2015-05-06 14:01:40 +03:00
parent 1f504e08ea
commit 928ce24132
9 changed files with 137 additions and 56 deletions

View file

@ -305,37 +305,6 @@ describe Contact do
end
end
describe Contact, '.check_availability' do
before do
Fabricate(:contact, code: 'asd12')
Fabricate(:contact, code: 'asd13')
end
it 'should return array if argument is string' do
response = Contact.check_availability('asd12')
response.class.should == Array
response.length.should == 1
end
it 'should return in_use and available codes' do
code = Contact.first.code
code_ = Contact.last.code
response = Contact.check_availability([code, code_, 'asd14'])
response.class.should == Array
response.length.should == 3
response[0][:avail].should == 0
response[0][:code].should == code
response[1][:avail].should == 0
response[1][:code].should == code_
response[2][:avail].should == 1
response[2][:code].should == 'asd14'
end
end
describe Contact, '.destroy_orphans' do
before do
@contact_1 = Fabricate(:contact, code: 'asd12')