@@ -45,6 +45,17 @@ describe ::ContactIdentifyAction do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when contact with same phone_number exists' do
|
||||
it 'merges the current contact to phone_number contact' do
|
||||
existing_phone_number_contact = create(:contact, account: account, phone_number: '+919999888877')
|
||||
params = { phone_number: '+919999888877' }
|
||||
result = described_class.new(contact: contact, params: params).perform
|
||||
expect(result.id).to eq existing_phone_number_contact.id
|
||||
expect(result.name).to eq existing_phone_number_contact.name
|
||||
expect { contact.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when contacts with blank identifiers exist and identify action is called with blank identifier' do
|
||||
it 'updates the attributes of contact passed in to identify action' do
|
||||
create(:contact, account: account, identifier: '')
|
||||
|
||||
Reference in New Issue
Block a user