Bug: Migrate messages while merging contact (#624)

Bug: Migrate messages while merging contact
This commit is contained in:
Pranav Raj S
2020-03-19 01:52:38 +05:30
committed by GitHub
parent 9d170fc727
commit 1c4566df66
3 changed files with 14 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ describe ::ContactMergeAction do
before do
2.times.each { create(:conversation, contact: base_contact) }
2.times.each { create(:conversation, contact: mergee_contact) }
2.times.each { create(:message, contact: mergee_contact) }
end
describe '#perform' do
@@ -32,6 +33,13 @@ describe ::ContactMergeAction do
end
end
context 'when mergee contact has messages' do
it 'moves the messages to base contact' do
contact_merge
expect(base_contact.messages.count).to be 2
end
end
context 'when contacts belong to a different account' do
it 'throws an exception' do
new_account = create(:account)