Sha256: 26d53bff7fe7d57b8229c8bf73c6d962f53a6701b328239244cf3ab16b0efc9e
Contents?: true
Size: 1.59 KB
Versions: 8
Compression:
Stored size: 1.59 KB
Contents
require 'spec_helper' describe Appsignal::Hooks::NetHttpHook do before :all do start_agent end context "with Net::HTTP instrumentation enabled" do its(:dependencies_present?) { should be_true } it "should instrument a http request" do Appsignal::Transaction.create('uuid', Appsignal::Transaction::HTTP_REQUEST, 'test') expect( Appsignal::Transaction.current ).to receive(:start_event) .at_least(:once) expect( Appsignal::Transaction.current ).to receive(:finish_event) .at_least(:once) .with("request.net_http", "GET http://www.google.com", nil, 0) stub_request(:any, 'http://www.google.com/') Net::HTTP.get_response(URI.parse('http://www.google.com')) end it "should instrument a https request" do Appsignal::Transaction.create('uuid', Appsignal::Transaction::HTTP_REQUEST, 'test') expect( Appsignal::Transaction.current ).to receive(:start_event) .at_least(:once) expect( Appsignal::Transaction.current ).to receive(:finish_event) .at_least(:once) .with("request.net_http", "GET https://www.google.com", nil, 0) 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) end end context "with Net::HTTP instrumentation disabled" do before { Appsignal.config.config_hash[:instrument_net_http] = false } after { Appsignal.config.config_hash[:instrument_net_http] = true } its(:dependencies_present?) { should be_false } end end
Version data entries
8 entries across 8 versions & 1 rubygems