diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/deprecation_toolkit_env.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/deprecation_toolkit_env.rb')
-rw-r--r-- | spec/deprecation_toolkit_env.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/deprecation_toolkit_env.rb b/spec/deprecation_toolkit_env.rb new file mode 100644 index 00000000000..bc90f67f0db --- /dev/null +++ b/spec/deprecation_toolkit_env.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +if ENV.key?('RECORD_DEPRECATIONS') + require 'deprecation_toolkit' + require 'deprecation_toolkit/rspec' + DeprecationToolkit::Configuration.test_runner = :rspec + DeprecationToolkit::Configuration.deprecation_path = 'deprecations' + DeprecationToolkit::Configuration.behavior = DeprecationToolkit::Behaviors::Record + + # Enable ruby deprecations for keywords, it's suppressed by default in Ruby 2.7.2 + Warning[:deprecated] = true + + kwargs_warnings = [ + # Taken from https://github.com/jeremyevans/ruby-warning/blob/1.1.0/lib/warning.rb#L18 + %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} + ] + DeprecationToolkit::Configuration.warnings_treated_as_deprecation = kwargs_warnings +end |