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 object has a non-empty Hash in the headers.

Examples:

Passes if the headers include the content length

require 'rspec-api-matchers'

headers = {'Content-Length' => 17372}
obj = OpenStruct.new headers: headers

describe 'have_headers' do
  include RSpecApi::Matchers::Headers
  it { expect(obj).to have_headers }
end

# => (rspec) 1 example, 0 failures

See Also:



22
23
24
# File 'lib/rspec-api/matchers/headers/have_headers.rb', line 22

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