chore: Set phone_number through Website SDK (#2803)

Fixes: #2599
This commit is contained in:
Aswin Dev P.S
2021-08-13 17:26:09 +05:30
committed by GitHub
parent dfcc33cbdd
commit 9e052fd5b2
5 changed files with 39 additions and 5 deletions

View File

@@ -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: '')