Skip to content

Make sure test helper clears the current scope before/after a test#1900

Merged
st0012 merged 2 commits intomasterfrom
fix-#1881
Sep 20, 2022
Merged

Make sure test helper clears the current scope before/after a test#1900
st0012 merged 2 commits intomasterfrom
fix-#1881

Conversation

@st0012
Copy link
Copy Markdown
Contributor

@st0012 st0012 commented Sep 17, 2022

Because the setup_sentry_test helper provides a clean client, the scope should be clean too. I also imagine teardown_sentry_test includes clearing the current scope's contextual data.

And because there's not a bind_client equivalent API for scope, we clear the scope's value with Scope#clear instead of creating a new scope. But in practice that both of them should work the same.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Base: 98.40% // Head: 98.41% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (65b7f9a) compared to base (ae13d7d).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1900      +/-   ##
==========================================
+ Coverage   98.40%   98.41%   +0.01%     
==========================================
  Files         148      148              
  Lines        8891     8897       +6     
==========================================
+ Hits         8749     8756       +7     
+ Misses        142      141       -1     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/test_helper.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/test_helper_spec.rb 100.00% <100.00%> (ø)
sentry-resque/lib/sentry/resque.rb 100.00% <0.00%> (+2.85%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Copy Markdown

@francois-ferrandis francois-ferrandis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

Because the `setup_sentry_test` helper provides a clean client, the
scope should be clean too. I also imagine `teardown_sentry_test`
includes clearing the current scope's contextual data.

And because there's not a `bind_client` equivalent API for scope, we
clear the scope's value with `Scope#clear` instead of creating a new
scope. But in practice that both of them should work the same.
@st0012 st0012 requested a review from sl0thentr0py September 19, 2022 22:38
@st0012 st0012 merged commit e18ce4b into master Sep 20, 2022
@st0012 st0012 deleted the fix-#1881 branch September 20, 2022 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants