chore: Delete related notifications if a conversation is deleted (#2592)

This commit is contained in:
Muhsin Keloth
2021-07-12 12:28:16 +05:30
committed by GitHub
parent 5726447e47
commit ba547b3f60
4 changed files with 22 additions and 1 deletions

View File

@@ -399,4 +399,15 @@ RSpec.describe Conversation, type: :model do
end
end
end
describe '#delete conversation' do
let!(:conversation) { create(:conversation) }
let!(:notification) { create(:notification, notification_type: 'conversation_creation', primary_actor: conversation) }
it 'delete associated notifications if conversation is deleted' do
conversation.destroy
expect { notification.reload }.to raise_error ActiveRecord::RecordNotFound
end
end
end