mirror of
https://github.com/mastodon/mastodon.git
synced 2025-02-08 16:05:05 +00:00
7efe0bde9d
Some checks are pending
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.1) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.1) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.1) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.1, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
34 lines
849 B
Ruby
34 lines
849 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec::Matchers.define :have_http_link_header do |href|
|
|
match do |response|
|
|
@response = response
|
|
|
|
header_link&.href == href
|
|
end
|
|
|
|
match_when_negated do |response|
|
|
response.headers['Link'].blank?
|
|
end
|
|
|
|
chain :for do |attributes|
|
|
@attributes = attributes
|
|
end
|
|
|
|
failure_message do |response|
|
|
"Expected `#{response.headers['Link']}` to include `href` value of `#{href}` for `#{@attributes}` but it did not."
|
|
end
|
|
|
|
failure_message_when_negated do
|
|
"Expected response not to have a `Link` header but `#{response.headers['Link']}` is present."
|
|
end
|
|
|
|
def header_link
|
|
LinkHeader
|
|
.parse(@response.headers['Link'])
|
|
.find_link(*@attributes.stringify_keys)
|
|
end
|
|
end
|
|
|
|
RSpec::Matchers.define_negated_matcher :not_have_http_link_header, :have_http_link_header # Allow chaining
|