2024-03-15 21:17:45 +11:00
|
|
|
# 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
|
|
|
|
|
2024-07-26 00:28:08 +10:00
|
|
|
failure_message do |response|
|
|
|
|
"expected that #{response.headers['Link']} would have the same values as #{links}."
|
2024-03-15 21:17:45 +11:00
|
|
|
end
|
|
|
|
end
|