-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow warnings to be clear only within a block #18
Comments
Note that the code of the proposed solution above does not work with |
I guess I'm OK with this feature. I don't like the name In terms of implementation, you need to dup |
@jeremyevans I love the idea of passing a block to I've adjusted the issue title and description. |
Problem
It's common practice to clear the internal state of
Warning
viaWarning.clear
.At GitLab, we use
Warning
to log deprecation warnings into a separate file.When testing this very behavior we are resetting the state via
Warning.clear
.Since we are planning to use
Warning
in specs to prevent already fixed deprecation warnings to sneak in again,Warning.clear
would clear also these definitions 😞Example
When running
rspec --order defined warning_spec.rb
I see a spec failure like:Proposed solution
Allow
Warning.clear
to accept a block. In this case the values are cleared only within the block and restored after the block end.In the example above we could pass a block to
Warning.clear { ... }
instead:Happy to open a PR if this solution is accepted ❤️
The text was updated successfully, but these errors were encountered: