Merge remote-tracking branch 'parent/main' into upstream-20250414

This commit is contained in:
KMY 2025-04-14 13:23:00 +09:00
commit dba5f3b93f
208 changed files with 3210 additions and 2896 deletions

View file

@ -1,23 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ImportWorker do
let(:worker) { described_class.new }
let(:service) { instance_double(ImportService, call: true) }
describe '#perform' do
before do
allow(ImportService).to receive(:new).and_return(service)
end
let(:import) { Fabricate(:import) }
it 'sends the import to the service' do
worker.perform(import.id)
expect(service).to have_received(:call).with(import)
expect { import.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end
end

View file

@ -5,6 +5,7 @@ require 'rails_helper'
RSpec.describe UnfilterNotificationsWorker do
let(:recipient) { Fabricate(:account) }
let(:sender) { Fabricate(:account) }
let(:worker) { described_class.new }
before do
# Populate multiple kinds of filtered notifications
@ -67,23 +68,22 @@ RSpec.describe UnfilterNotificationsWorker do
end
describe '#perform' do
context 'with single argument (prerelease behavior)' do
subject { described_class.new.perform(notification_request.id) }
let(:notification_request) { Fabricate(:notification_request, from_account: sender, account: recipient) }
context 'with recipient and sender' do
subject { worker.perform(recipient.id, sender.id) }
it_behaves_like 'shared behavior'
it 'destroys the notification request' do
expect { subject }
.to change { NotificationRequest.exists?(notification_request.id) }.to(false)
end
end
context 'with two arguments' do
subject { described_class.new.perform(recipient.id, sender.id) }
context 'with missing records' do
it 'runs without error for missing sender' do
expect { worker.perform(recipient.id, nil) }
.to_not raise_error
end
it_behaves_like 'shared behavior'
it 'runs without error for missing recipient' do
expect { worker.perform(nil, sender.id) }
.to_not raise_error
end
end
end
end