diff options
Diffstat (limited to 'qa/qa/specs/qa_deprecation_toolkit_env.rb')
-rw-r--r-- | qa/qa/specs/qa_deprecation_toolkit_env.rb | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/qa/qa/specs/qa_deprecation_toolkit_env.rb b/qa/qa/specs/qa_deprecation_toolkit_env.rb index 21ef5a6f229..5224a2e9ae0 100644 --- a/qa/qa/specs/qa_deprecation_toolkit_env.rb +++ b/qa/qa/specs/qa_deprecation_toolkit_env.rb @@ -5,20 +5,24 @@ require 'deprecation_toolkit/rspec' require 'concurrent/utility/monotonic_time' require 'active_support/gem_version' -module QaDeprecationToolkitEnv - # Taken from https://github.com/jeremyevans/ruby-warning/blob/1.1.0/lib/warning.rb#L18 - # rubocop:disable Layout/LineLength - def self.kwargs_warning - %r{warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z} - end - # rubocop:enable Layout/LineLength +module QA + module Specs + class QaDeprecationToolkitEnv + # Taken from https://github.com/jeremyevans/ruby-warning/blob/1.1.0/lib/warning.rb#L18 + # rubocop:disable Layout/LineLength + def self.kwargs_warning + %r{warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z} + end + # rubocop:enable Layout/LineLength - def self.configure! - # Enable ruby deprecations for keywords, it's suppressed by default in Ruby 2.7 - Warning[:deprecated] = true + def self.configure! + # Enable ruby deprecations for keywords, it's suppressed by default in Ruby 2.7 + Warning[:deprecated] = true - DeprecationToolkit::Configuration.test_runner = :rspec - DeprecationToolkit::Configuration.deprecation_path = 'deprecations' - DeprecationToolkit::Configuration.warnings_treated_as_deprecation = [kwargs_warning] + DeprecationToolkit::Configuration.test_runner = :rspec + DeprecationToolkit::Configuration.deprecation_path = 'deprecations' + DeprecationToolkit::Configuration.warnings_treated_as_deprecation = [kwargs_warning] + end + end end end |