You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: stub_requests.rb
    path of file: ./repos/gitlabhq/gems/gitlab-http/spec/gitlab
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Gitlab
  module StubRequests
    IP_ADDRESS_STUB = '8.8.8.9'

    # Fully stubs a request using WebMock class. This class
    
    def stub_dns(url, ip_address:, port: 80)
      url = parse_url(url)
      socket = Socket.sockaddr_in(port, ip_address)
      addr = Addrinfo.new(socket)

      # See Gitlab::HTTP_V2::UrlBlocker
      allow(Addrinfo).to receive(:getaddrinfo)
                          .with(url.hostname, url.port, nil, :STREAM)
                          .and_return([addr])
    end