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

@ -18,32 +18,22 @@ RSpec.describe 'Mutes' do
it_behaves_like 'forbidden for wrong scope', 'write write:mutes'
it 'returns http success' do
it 'returns http success with muted accounts' do
subject
expect(response).to have_http_status(200)
end
it 'returns the muted accounts' do
subject
muted_accounts = mutes.map(&:target_account)
expect(response.parsed_body.pluck(:id)).to match_array(muted_accounts.map { |account| account.id.to_s })
end
context 'with limit param' do
let(:params) { { limit: 1 } }
it 'returns only the requested number of muted accounts' do
it 'returns only the requested number of muted accounts with pagination headers' do
subject
expect(response.parsed_body.size).to eq(params[:limit])
end
it 'sets the correct pagination headers', :aggregate_failures do
subject
expect(response)
.to include_pagination_headers(
prev: api_v1_mutes_url(limit: params[:limit], since_id: mutes.last.id),