From 4cffd5a2cf566a46d5d9bb8102b759de95eac5ba Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Mon, 17 Nov 2025 13:25:21 +0000 Subject: [PATCH 1/2] chore(specs): minor formatting fix --- sentry-ruby/spec/sentry/client_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry-ruby/spec/sentry/client_spec.rb b/sentry-ruby/spec/sentry/client_spec.rb index 56bab2e9e..9ec943b19 100644 --- a/sentry-ruby/spec/sentry/client_spec.rb +++ b/sentry-ruby/spec/sentry/client_spec.rb @@ -9,13 +9,14 @@ def sentry_context end RSpec.describe Sentry::Client do + subject { Sentry::Client.new(configuration) } + let(:configuration) do Sentry::Configuration.new.tap do |config| config.dsn = Sentry::TestHelper::DUMMY_DSN config.transport.transport_class = Sentry::DummyTransport end end - subject { Sentry::Client.new(configuration) } let(:hub) do Sentry::Hub.new(subject, Sentry::Scope.new) From cdf4d28c80517e4ef1becc5e75b4f68394a98956 Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Mon, 17 Nov 2025 13:29:24 +0000 Subject: [PATCH 2/2] fix(specs): remove global class from client spec --- sentry-ruby/spec/sentry/client_spec.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sentry-ruby/spec/sentry/client_spec.rb b/sentry-ruby/spec/sentry/client_spec.rb index 9ec943b19..88b73c7ec 100644 --- a/sentry-ruby/spec/sentry/client_spec.rb +++ b/sentry-ruby/spec/sentry/client_spec.rb @@ -1,13 +1,5 @@ # frozen_string_literal: true -class ExceptionWithContext < StandardError - def sentry_context - { - foo: "bar" - } - end -end - RSpec.describe Sentry::Client do subject { Sentry::Client.new(configuration) } @@ -572,8 +564,18 @@ module ExcTag; end end context 'when the exception responds to sentry_context' do + let(:exception_with_context) do + Class.new(StandardError) do + def sentry_context + { + foo: "bar" + } + end + end + end + let(:hash) do - event = subject.event_from_exception(ExceptionWithContext.new) + event = subject.event_from_exception(exception_with_context.new) event.to_h end