stub!

in spec/support/mock_intake.rb [58:87]


  def stub!
    @cloud_provider_stubs = {
      aws: WebMock.stub_request(
        :get, ElasticAPM::Metadata::CloudInfo::AWS_URI
      ).to_timeout,
      gcp: WebMock.stub_request(
        :get, ElasticAPM::Metadata::CloudInfo::GCP_URI
      ).to_timeout,
      azure: WebMock.stub_request(
        :get, ElasticAPM::Metadata::CloudInfo::AZURE_URI
      ).to_timeout
    }

    @central_config_stub =
      WebMock.stub_request(
        :get, %r{^http://localhost:8200/config/v1/agents/?$}
      ).to_return(body: '{}')

    @server_version_stub =
      WebMock.stub_request(:get, %r{^http://localhost:8200/$}).
      to_return(body: '{"version":8.0}')

    @request_stub =
      WebMock.stub_request(
        :post, %r{^http://localhost:8200/intake/v2/events/?$}
      ).to_rack(self)

    self
  end