Fix ArgumentError when Warning.process is used again
What does this MR do and why?
This MR fixes an ArgumentError
raised after Warning.process
is used
twice.
Consider this:
require 'warning'
Warning.process(/foo/) { :raise }
Warning.process(/bar/) { :raise }
# => ArgumentError (comparison of Regexp with Regexp failed)
The first argument of Warning.process
must be a path
and actions
can be passed as a Hash
:
require 'warning'
Warning.process('', /foo/ => :raise)
Warning.process('', /bar/ => :raise)
warn("foo") # => RuntimeError (foo)
warn("bar") # => RuntimeError (bar)
There's an upstream GitHub issue that discusses this problem: https://github.com/jeremyevans/ruby-warning/issues/17 (closed) and the fix https://github.com/jeremyevans/ruby-warning/pull/19 (merged).
How to set up and validate locally
On master
do:
bundle exec rails console
Warning.process('') { :raise }
-
💥 ArgumentError: comparison of Regexp with String failed
On pl-fix-log-deprecations-initializer
do:
bundle exec rails console
Warning.process('') { :raise }
- Verify via
warn 'anything'
to raiseRuntimeError: anything
✅
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen