diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 645faa6048..6b6a4a89e9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -52,11 +52,7 @@ RSpec/LetSetup: - 'spec/controllers/auth/sessions_controller_spec.rb' - 'spec/models/account_statuses_cleanup_policy_spec.rb' - 'spec/models/status_spec.rb' - - 'spec/services/account_statuses_cleanup_service_spec.rb' - 'spec/services/activitypub/fetch_featured_collection_service_spec.rb' - - 'spec/services/activitypub/fetch_remote_status_service_spec.rb' - - 'spec/services/activitypub/process_account_service_spec.rb' - - 'spec/services/activitypub/process_collection_service_spec.rb' - 'spec/services/batched_remove_status_service_spec.rb' - 'spec/services/block_domain_service_spec.rb' - 'spec/services/bulk_import_service_spec.rb' diff --git a/spec/services/account_statuses_cleanup_service_spec.rb b/spec/services/account_statuses_cleanup_service_spec.rb index f7a88a9172..0ac113f105 100644 --- a/spec/services/account_statuses_cleanup_service_spec.rb +++ b/spec/services/account_statuses_cleanup_service_spec.rb @@ -39,6 +39,13 @@ describe AccountStatusesCleanupService, type: :service do it 'actually deletes the statuses' do subject.call(account_policy, 10) expect(Status.find_by(id: [very_old_status.id, old_status.id, another_old_status.id])).to be_nil + expect { recent_status.reload }.to_not raise_error + end + + it 'preserves recent and unrelated statuses' do + subject.call(account_policy, 10) + expect { unrelated_status.reload }.to_not raise_error + expect { recent_status.reload }.to_not raise_error end end diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb index 826b67d884..3c64feaeec 100644 --- a/spec/services/activitypub/fetch_remote_status_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb @@ -8,7 +8,6 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do subject { described_class.new } let!(:sender) { Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar') } - let!(:recipient) { Fabricate(:account) } let(:existing_status) { nil } diff --git a/spec/services/activitypub/process_account_service_spec.rb b/spec/services/activitypub/process_account_service_spec.rb index 09eb5ddee3..58dd2badbb 100644 --- a/spec/services/activitypub/process_account_service_spec.rb +++ b/spec/services/activitypub/process_account_service_spec.rb @@ -33,7 +33,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do end context 'when account is not suspended' do - subject { described_class.new.call('alice', 'example.com', payload) } + subject { described_class.new.call(account.username, account.domain, payload) } let!(:account) { Fabricate(:account, username: 'alice', domain: 'example.com') } diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index df526daf34..f4a2b8fec6 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -242,7 +242,8 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do it 'does not process forged payload' do allow(ActivityPub::Activity).to receive(:factory) - subject.call(json, forwarder) + expect { subject.call(json, forwarder) } + .to_not change(actor.reload.statuses, :count) expect(ActivityPub::Activity).to_not have_received(:factory).with( hash_including(