0
0
Fork 0

Change notification request acceptance to immediately delete the request (#31256)

This commit is contained in:
Claire 2024-08-14 09:34:30 +02:00 committed by GitHub
parent 3e3450be36
commit 7996a9543d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 83 additions and 6 deletions

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe AcceptNotificationRequestService do
subject { described_class.new }
let(:notification_request) { Fabricate(:notification_request) }
describe '#call' do
it 'destroys the notification request, creates a permission, and queues a worker' do
expect { subject.call(notification_request) }
.to change { NotificationRequest.exists?(notification_request.id) }.to(false)
.and change { NotificationPermission.exists?(account_id: notification_request.account_id, from_account_id: notification_request.from_account_id) }.to(true)
expect(UnfilterNotificationsWorker).to have_enqueued_sidekiq_job(notification_request.account_id, notification_request.from_account_id)
end
end
end