mirror of
https://github.com/mastodon/mastodon
synced 2024-11-27 14:28:24 +09:00
Remove double subject call in services/delete_account_service
spec (#28212)
This commit is contained in:
parent
be6bb1a10d
commit
ed7b5c091b
@ -27,8 +27,15 @@ RSpec.describe DeleteAccountService, type: :service do
|
||||
|
||||
let!(:account_note) { Fabricate(:account_note, account: account) }
|
||||
|
||||
it 'deletes associated owned records' do
|
||||
expect { subject }.to change {
|
||||
it 'deletes associated owned and target records and target notifications' do
|
||||
expect { subject }
|
||||
.to delete_associated_owned_records
|
||||
.and delete_associated_target_records
|
||||
.and delete_associated_target_notifications
|
||||
end
|
||||
|
||||
def delete_associated_owned_records
|
||||
change do
|
||||
[
|
||||
account.statuses,
|
||||
account.media_attachments,
|
||||
@ -39,23 +46,23 @@ RSpec.describe DeleteAccountService, type: :service do
|
||||
account.polls,
|
||||
account.account_notes,
|
||||
].map(&:count)
|
||||
}.from([2, 1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0, 0])
|
||||
end.from([2, 1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'deletes associated target records' do
|
||||
expect { subject }.to change {
|
||||
def delete_associated_target_records
|
||||
change do
|
||||
[
|
||||
AccountPin.where(target_account: account),
|
||||
].map(&:count)
|
||||
}.from([1]).to([0])
|
||||
end.from([1]).to([0])
|
||||
end
|
||||
|
||||
it 'deletes associated target notifications' do
|
||||
expect { subject }.to change {
|
||||
def delete_associated_target_notifications
|
||||
change do
|
||||
%w(
|
||||
poll favourite status mention follow
|
||||
).map { |type| Notification.where(type: type).count }
|
||||
}.from([1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0])
|
||||
end.from([1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0])
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user