mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 08:48:53 +00:00
Add include_pagination_headers matcher to check Link header in api specs (#29596)
This commit is contained in:
@@ -98,9 +98,14 @@ RSpec.describe 'Notifications' do
|
||||
|
||||
notifications = user.account.notifications
|
||||
|
||||
expect(body_as_json.size).to eq(params[:limit])
|
||||
expect(response.headers['Link'].find_link(%w(rel prev)).href).to eq(api_v1_notifications_url(limit: params[:limit], min_id: notifications.last.id.to_s))
|
||||
expect(response.headers['Link'].find_link(%w(rel next)).href).to eq(api_v1_notifications_url(limit: params[:limit], max_id: notifications[2].id.to_s))
|
||||
expect(body_as_json.size)
|
||||
.to eq(params[:limit])
|
||||
|
||||
expect(response)
|
||||
.to include_pagination_headers(
|
||||
prev: api_v1_notifications_url(limit: params[:limit], min_id: notifications.last.id),
|
||||
next: api_v1_notifications_url(limit: params[:limit], max_id: notifications[2].id)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user