Module: RSpecApi::Matchers::Headers

Defined in:
lib/rspec-api/matchers/headers/matcher.rb,
lib/rspec-api/matchers/headers/have_headers.rb

Defined Under Namespace

Classes: Matcher

Instance Method Summary collapse

Instance Method Details

#have_headersObject

Passes if the response has a non-empty headers Hash.

For more examples check have_headers_spec.rb.

Examples:


# Passes if the headers include the content length
headers = {'Content-Length' => 17372}
expect(OpenStruct.new headers: headers).to have_headers


15
16
17
# File 'lib/rspec-api/matchers/headers/have_headers.rb', line 15

def have_headers
  RSpecApi::Matchers::Headers::Matcher.new
end