diff --git a/sentry-ruby/spec/sentry/net/http_spec.rb b/sentry-ruby/spec/sentry/net/http_spec.rb index 1b5c00a1c..3e50f9cbe 100644 --- a/sentry-ruby/spec/sentry/net/http_spec.rb +++ b/sentry-ruby/spec/sentry/net/http_spec.rb @@ -6,49 +6,37 @@ RSpec.describe Sentry::Net::HTTP do include_context "with request mock" - around do |example| - WebMock.disable! - example.run - WebMock.enable! - end - let(:string_io) { StringIO.new } let(:logger) do ::Logger.new(string_io) end - context "with IPv6 addresses" do + context "with tracing enabled" do before do perform_basic_setup do |config| config.traces_sample_rate = 1.0 + config.transport.transport_class = Sentry::HTTPTransport + config.logger = logger + # the dsn needs to have a real host so we can make a real connection before sending a failed request + config.dsn = 'http://foobarbaz@o447951.ingest.sentry.io/5434472' end end - it "correctly parses the short-hand IPv6 addresses" do - stub_normal_response - - transaction = Sentry.start_transaction - Sentry.get_current_scope.set_span(transaction) + context "with IPv6 addresses" do + it "correctly parses the short-hand IPv6 addresses" do + stub_normal_response - _ = Net::HTTP.get("::1", "/path", 8080) + transaction = Sentry.start_transaction + Sentry.get_current_scope.set_span(transaction) - expect(transaction.span_recorder.spans.count).to eq(2) + _ = Net::HTTP.get("::1", "/path", 8080) - request_span = transaction.span_recorder.spans.last - expect(request_span.data).to eq( - { "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 } - ) - end - end + expect(transaction.span_recorder.spans.count).to eq(2) - context "with tracing enabled" do - before do - perform_basic_setup do |config| - config.traces_sample_rate = 1.0 - config.transport.transport_class = Sentry::HTTPTransport - config.logger = logger - # the dsn needs to have a real host so we can make a real connection before sending a failed request - config.dsn = 'http://foobarbaz@o447951.ingest.sentry.io/5434472' + request_span = transaction.span_recorder.spans.last + expect(request_span.data).to eq( + { "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 } + ) end end diff --git a/sentry-ruby/spec/sentry/rspec/matchers_spec.rb b/sentry-ruby/spec/sentry/rspec/matchers_spec.rb index 45e914f52..c20a7cfd3 100644 --- a/sentry-ruby/spec/sentry/rspec/matchers_spec.rb +++ b/sentry-ruby/spec/sentry/rspec/matchers_spec.rb @@ -12,6 +12,7 @@ config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472' config.enabled_environments = ["production"] config.environment = :test + config.transport.transport_class = Sentry::DummyTransport end setup_sentry_test