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

@ -0,0 +1,13 @@
# frozen_string_literal: true
RSpec::Matchers.define :include_pagination_headers do |links|
match do |response|
links.map do |key, value|
response.headers['Link'].find_link(['rel', key.to_s]).href == value
end.all?
end
failure_message do |header|
"expected that #{header} would have the same values as #{links}."
end
end