diff --git a/spec/support/matchers/http_headers.rb b/spec/support/matchers/http_headers.rb new file mode 100644 index 00000000000..6896037f33a --- /dev/null +++ b/spec/support/matchers/http_headers.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +RSpec::Matchers.define :have_http_header do |header, values| + match do |response| + response.headers[header].match?(values) + end + + failure_message do |response| + "Expected that `#{header}` would have values of `#{values}` but was `#{response.headers[header]}`" + end +end