You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sentry::TestHelper.setup_sentry_test accepts a block that can mutate the configuration to be used, but teardown_sentry_test leaves that configuration in the client.
Reproduction Steps
Added a case to spec/sentry/test_helper_spec.rb that shows this:
describe "#teardown_sentry_test" do
let(:custom) { -> (c) { } }
before do
setup_sentry_test(&custom)
end
it "clears stored events" do
Sentry.capture_message("foobar")
expect(sentry_events.count).to eq(1)
teardown_sentry_test
expect(sentry_events.count).to eq(0)
end
it "clears stored envelopes" do
event = Sentry.get_current_client.event_from_message("foobar")
envelope = sentry_transport.envelope_from_event(event)
sentry_transport.send_envelope(envelope)
expect(sentry_envelopes.count).to eq(1)
teardown_sentry_test
expect(sentry_envelopes.count).to eq(0)
end
it "clears the scope" do
Sentry.set_tags(foo: "bar")
teardown_sentry_test
expect(Sentry.get_current_scope.tags).to eq({})
end
context "when the configuration is mutated" do
let(:custom) { -> (c) { c.environment = "quack" } }
it "rolls back client changes" do
expect(Sentry.configuration.environment).to eq("quack")
teardown_sentry_test
expect(Sentry.configuration.environment).to eq("unspecified")
end
end
end
Expected Behavior
The new spec should pass, because calling teardown_sentry_test should reset the client configuration.
Actual Behavior
Sentry::TestHelper#teardown_sentry_test when the configuration is mutated rolls back client changes
Failure/Error: expect(Sentry.configuration.environment).to eq("test")
expected: "test"
got: "quack"
(compared using ==)
# ./spec/sentry/test_helper_spec.rb:131:in `block (4 levels) in <top (required)>'
Ruby Version
2.6.10
SDK Version
main
Integration and Its Version
No response
Sentry Config
No response
The text was updated successfully, but these errors were encountered:
Issue Description
Sentry::TestHelper.setup_sentry_test
accepts a block that can mutate the configuration to be used, butteardown_sentry_test
leaves that configuration in the client.Reproduction Steps
Added a case to
spec/sentry/test_helper_spec.rb
that shows this:Expected Behavior
The new spec should pass, because calling
teardown_sentry_test
should reset the client configuration.Actual Behavior
Ruby Version
2.6.10
SDK Version
main
Integration and Its Version
No response
Sentry Config
No response
The text was updated successfully, but these errors were encountered: