From 5b7394f7213254b3d61e8e06624cd9acfb881023 Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Mon, 26 Aug 2024 08:57:57 +0000 Subject: [PATCH] Fix flaky spec Seems like StackProf.results is leaking between specs when it's stubbed via `allow`, so we gotta restub it in the profiler spec too. --- sentry-ruby/spec/sentry/profiler_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry-ruby/spec/sentry/profiler_spec.rb b/sentry-ruby/spec/sentry/profiler_spec.rb index e0cba8177..9100a3441 100644 --- a/sentry-ruby/spec/sentry/profiler_spec.rb +++ b/sentry-ruby/spec/sentry/profiler_spec.rb @@ -174,10 +174,11 @@ subject.set_initial_sample_decision(true) subject.start subject.stop + + allow(StackProf).to receive(:results).and_return([]) end it 'returns empty' do - expect(StackProf).to receive(:results).and_call_original expect(subject.to_hash).to eq({}) end