Sha256: be3341d8a2b0f355bbaa35394024c7e2d0612d8272b10c6f9aa0e60662e5cfab

Contents?: true

Size: 952 Bytes

Versions: 6

Compression:

Stored size: 952 Bytes

Contents

require "appsignal/integrations/net_http"

describe Appsignal::Integrations::NetHttpIntegration do
  let(:transaction) { http_request_transaction }
  before(:context) { start_agent }
  before { set_current_transaction transaction }
  around { |example| keep_transactions { example.run } }

  it "instruments a http request" do
    stub_request(:any, "http://www.google.com/")

    Net::HTTP.get_response(URI.parse("http://www.google.com"))

    expect(transaction).to include_event(
      "name" => "request.net_http",
      "title" => "GET http://www.google.com"
    )
  end

  it "instruments a https request" do
    stub_request(:any, "https://www.google.com/")

    uri = URI.parse("https://www.google.com")
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.get(uri.request_uri)

    expect(transaction).to include_event(
      "name" => "request.net_http",
      "title" => "GET https://www.google.com"
    )
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
appsignal-3.11.0-java spec/lib/appsignal/integrations/net_http_spec.rb
appsignal-3.11.0 spec/lib/appsignal/integrations/net_http_spec.rb
appsignal-3.10.0-java spec/lib/appsignal/integrations/net_http_spec.rb
appsignal-3.10.0 spec/lib/appsignal/integrations/net_http_spec.rb
appsignal-3.9.3-java spec/lib/appsignal/integrations/net_http_spec.rb
appsignal-3.9.3 spec/lib/appsignal/integrations/net_http_spec.rb