0
0
Fork 0

Add include_pagination_headers matcher to check Link header in api specs (#29596)

This commit is contained in:
Matt Jankowski 2024-03-15 06:17:45 -04:00 committed by GitHub
parent 6865fda593
commit 2e91a9bd34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 67 additions and 46 deletions

View file

@ -44,10 +44,11 @@ RSpec.describe 'Mutes' do
it 'sets the correct pagination headers', :aggregate_failures do
subject
headers = response.headers['Link']
expect(headers.find_link(%w(rel prev)).href).to eq(api_v1_mutes_url(limit: params[:limit], since_id: mutes.last.id.to_s))
expect(headers.find_link(%w(rel next)).href).to eq(api_v1_mutes_url(limit: params[:limit], max_id: mutes.last.id.to_s))
expect(response)
.to include_pagination_headers(
prev: api_v1_mutes_url(limit: params[:limit], since_id: mutes.last.id),
next: api_v1_mutes_url(limit: params[:limit], max_id: mutes.last.id)
)
end
end