Sha256: 4998121d26d66ccb956277901aed88ecba7549d2bbcb337d626b6a5aee3e1e18
Contents?: true
Size: 1.21 KB
Versions: 57
Compression:
Stored size: 1.21 KB
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 generate an event for a http request" do stub_request(:any, 'http://www.google.com/') Net::HTTP.get_response(URI.parse('http://www.google.com')) event = events.last event.name.should == 'request.net_http' event.payload[:protocol].should == 'http' event.payload[:domain].should == 'www.google.com' event.payload[:path].should == '/' event.payload[:method].should == 'GET' end it "should generate an event for 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) event = events.last event.name.should == 'request.net_http' event.payload[:protocol].should == 'https' event.payload[:domain].should == 'www.google.com' event.payload[:path].should == '/' event.payload[:method].should == 'GET' end end
Version data entries
57 entries across 57 versions & 1 rubygems