Skip to content

Commit 8c292a3

Browse files
committed
Fix problematic spec
1 parent cdbb73f commit 8c292a3

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

sentry-ruby/spec/sentry/net/http_spec.rb

+16-28
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,37 @@
66
RSpec.describe Sentry::Net::HTTP do
77
include_context "with request mock"
88

9-
around do |example|
10-
WebMock.disable!
11-
example.run
12-
WebMock.enable!
13-
end
14-
159
let(:string_io) { StringIO.new }
1610
let(:logger) do
1711
::Logger.new(string_io)
1812
end
1913

20-
context "with IPv6 addresses" do
14+
context "with tracing enabled" do
2115
before do
2216
perform_basic_setup do |config|
2317
config.traces_sample_rate = 1.0
18+
config.transport.transport_class = Sentry::HTTPTransport
19+
config.logger = logger
20+
# the dsn needs to have a real host so we can make a real connection before sending a failed request
21+
config.dsn = 'http://[email protected]/5434472'
2422
end
2523
end
2624

27-
it "correctly parses the short-hand IPv6 addresses" do
28-
stub_normal_response
29-
30-
transaction = Sentry.start_transaction
31-
Sentry.get_current_scope.set_span(transaction)
25+
context "with IPv6 addresses" do
26+
it "correctly parses the short-hand IPv6 addresses" do
27+
stub_normal_response
3228

33-
_ = Net::HTTP.get("::1", "/path", 8080)
29+
transaction = Sentry.start_transaction
30+
Sentry.get_current_scope.set_span(transaction)
3431

35-
expect(transaction.span_recorder.spans.count).to eq(2)
32+
_ = Net::HTTP.get("::1", "/path", 8080)
3633

37-
request_span = transaction.span_recorder.spans.last
38-
expect(request_span.data).to eq(
39-
{ "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 }
40-
)
41-
end
42-
end
34+
expect(transaction.span_recorder.spans.count).to eq(2)
4335

44-
context "with tracing enabled" do
45-
before do
46-
perform_basic_setup do |config|
47-
config.traces_sample_rate = 1.0
48-
config.transport.transport_class = Sentry::HTTPTransport
49-
config.logger = logger
50-
# the dsn needs to have a real host so we can make a real connection before sending a failed request
51-
config.dsn = 'http://[email protected]/5434472'
36+
request_span = transaction.span_recorder.spans.last
37+
expect(request_span.data).to eq(
38+
{ "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 }
39+
)
5240
end
5341
end
5442

sentry-ruby/spec/sentry/rspec/matchers_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
config.dsn = 'https://[email protected]/5434472'
1313
config.enabled_environments = ["production"]
1414
config.environment = :test
15+
config.transport.transport_class = Sentry::DummyTransport
1516
end
1617

1718
setup_sentry_test

0 commit comments

Comments
 (0)