0
0
Fork 0

Combine API request spec assertions (#31970)

This commit is contained in:
Matt Jankowski 2024-09-19 06:15:21 -04:00 committed by GitHub
parent 1fce55cf5d
commit b071e618e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 36 additions and 232 deletions

View file

@ -28,31 +28,14 @@ RSpec.describe 'Deleting profile images' do
it_behaves_like 'forbidden for wrong scope', 'read'
end
it 'returns http success' do
it 'returns http success and deletes the avatar, preserves the header, queues up distribution' do
delete '/api/v1/profile/avatar', headers: headers
expect(response).to have_http_status(200)
end
it 'deletes the avatar' do
delete '/api/v1/profile/avatar', headers: headers
account.reload
expect(account.avatar).to_not exist
end
it 'does not delete the header' do
delete '/api/v1/profile/avatar', headers: headers
account.reload
expect(account.header).to exist
end
it 'queues up an account update distribution' do
delete '/api/v1/profile/avatar', headers: headers
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
end
end
@ -66,31 +49,14 @@ RSpec.describe 'Deleting profile images' do
it_behaves_like 'forbidden for wrong scope', 'read'
end
it 'returns http success' do
it 'returns http success, preserves the avatar, deletes the header, queues up distribution' do
delete '/api/v1/profile/header', headers: headers
expect(response).to have_http_status(200)
end
it 'does not delete the avatar' do
delete '/api/v1/profile/header', headers: headers
account.reload
expect(account.avatar).to exist
end
it 'deletes the header' do
delete '/api/v1/profile/header', headers: headers
account.reload
expect(account.header).to_not exist
end
it 'queues up an account update distribution' do
delete '/api/v1/profile/header', headers: headers
expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
end
end