module RSpecApi::Expectations::Response::Headers::ContentType

Public Instance Methods

expect_content_type(response, expectations = {}) click to toggle source
# File lib/rspec-api/expectations/headers/content_type.rb, line 8
def expect_content_type(response, expectations = {})
  include RSpecApi::Matchers

  if should_check_content_type(response, expectations)
    it { expect(response).to have_content_type expectations[:type] }
  end
end

Private Instance Methods

should_check_content_type(response, expectations) click to toggle source
# File lib/rspec-api/expectations/headers/content_type.rb, line 18
def should_check_content_type(response, expectations)
  expectations.key?(:type) && has_entity_body?(response)
end