module GdsApi::TestHelpers::PublishingApiV2

def publishing_api_has_fields_for_document(document_type, items, fields)

publishing_api_has_content allows for flexible passing in of arguments, please use instead
This method has been refactored into publishing_api_has_content (above)
def publishing_api_has_fields_for_document(document_type, items, fields)
  body = Array(items).map { |item|
    deep_stringify_keys(item).slice(*fields)
  }
  query_params = fields.map { |f|
    "&fields%5B%5D=#{f}"
  }
  url = PUBLISHING_API_V2_ENDPOINT + "/content?document_type=#{document_type}#{query_params.join('')}"
  stub_request(:get, url).to_return(status: 200, body: { results: body }.to_json, headers: {})
end