Sha256: 6ee95753d4983405ca0032e4b65b214d2e22a0122263d263347862d45fa18ca9

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

require 'spec_helper'
require File.expand_path('lib/appsignal/instrumentations/net_http')

describe "Net::HTTP instrumentation" do
  let(:events) { [] }
  before do
    ActiveSupport::Notifications.subscribe(/^[^!]/) do |*args|
      events << ActiveSupport::Notifications::Event.new(*args)
    end
  end

  it "should instrument request" do
    # We want to be absolutely sure the original method gets called correctly,
    # so we actually do a HTTP request.
    response = Net::HTTP.get_response(URI.parse('https://www.google.com'))

    response.body.should include('google')

    event = events.last
    event.name.should == 'request.net_http'
    event.payload[:host].should == 'www.google.com'
    event.payload[:scheme].should == 'https'
    event.payload[:path].should == '/'
    event.payload[:method].should == 'GET'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
appsignal-0.9.1 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.9.0 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.9.0.beta.1 spec/lib/appsignal/instrumentations/net_http_spec.rb
appsignal-0.9.0.alpha.1 spec/lib/appsignal/instrumentations/net_http_spec.rb