dismiss_notification_request_service_spec.rb 614 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe DismissNotificationRequestService do
  4. describe '#call' do
  5. let(:sender) { Fabricate(:account) }
  6. let(:receiver) { Fabricate(:account) }
  7. let(:request) { Fabricate(:notification_request, account: receiver, from_account: sender) }
  8. it 'destroys the request and queues a worker', :aggregate_failures do
  9. expect { described_class.new.call(request) }
  10. .to change(request, :destroyed?).to(true)
  11. expect(FilteredNotificationCleanupWorker)
  12. .to have_enqueued_sidekiq_job(receiver.id, sender.id)
  13. end
  14. end
  15. end