mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 19:56:04 +01:00
Clean up of RSpec/LetSetup
within spec/services/activitypub
(#28445)
This commit is contained in:
parent
c99f88e1a8
commit
efd16f3c2c
5 changed files with 10 additions and 7 deletions
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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') }
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue