File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ # Targeted silencing of a noisy deprecation coming from the oauth gem on Ruby >= 3.4.
4+ #
5+ # Example warning seen during specs:
6+ # .../gems/oauth-1.1.0/lib/oauth/helper.rb:21: warning: URI::RFC3986_PARSER.escape is obsolete. Use URI::RFC2396_PARSER.escape explicitly.
7+ #
8+ # We only filter this single message to avoid hiding other useful warnings.
9+ # This is test-only; it does not affect consumers of the library.
10+ begin
11+ original_warning_warn = Warning . method ( :warn )
12+
13+ Warning . define_singleton_method ( :warn ) do |message |
14+ if message =~ /lib\/ oauth\/ helper\. rb:.*URI::RFC3986_PARSER\. escape is obsolete/
15+ # swallow this specific, known deprecation from the oauth gem
16+ nil
17+ else
18+ original_warning_warn . call ( message )
19+ end
20+ end
21+ rescue StandardError # rubocop:disable Lint/SuppressedException -- best-effort; don't break older Rubies
22+ # If Warning.method(:warn) is not available on this Ruby, or redefining fails,
23+ # silently skip — tests can proceed without the filter.
24+ end
Original file line number Diff line number Diff line change 66# Internal ENV config
77require_relative "config/debug"
88require_relative "config/vcr"
9+ require_relative "config/warnings"
910
1011# RSpec config
1112require_relative "config/rspec/rack_test"
You can’t perform that action at this time.
0 commit comments