Skip to content
代码片段 群组 项目
未验证 提交 4512c0d9 编辑于 作者: Peter Leitzen's avatar Peter Leitzen
浏览文件

Ignore Ruby warnings from rspec-parameterized-table_syntax in Ruby < 3.2

When running in Ruby < 3.2 rspec-parameterized-table_syntax emits the
following warning:

  ... ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:38: warning: Refinement#include is deprecated and will be removed in Ruby 3.2

The gem already took care of this and already supports
Refinements#import_methods for Ruby 3.2+.

To silence this distracting (and useless warning) we use ignore this
specific warnings from this very gem (and only this gem) by using
`Warning.ignore`.
上级 b8964ba6
No related branches found
No related tags found
无相关合并请求
# frozen_string_literal: true
require_relative '../lib/gitlab/utils'
return if Gitlab::Utils.to_boolean(ENV['SILENCE_DEPRECATIONS'], default: false)
# Enable deprecation warnings by default and make them more visible
# to developers to ease upgrading to newer Ruby versions.
Warning[:deprecated] = true
# rubocop:disable Layout/LineLength
case RUBY_VERSION[/\d+\.\d+/, 0]
when '3.2'
warn "#{__FILE__}:#{__LINE__}: warning: Ignored warnings for Ruby < 3.2 are no longer necessary."
else
require 'warning'
# Ignore Ruby warnings until Ruby 3.2.
# ... ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rspec-parameterized-table_syntax-1.0.0/lib/rspec/parameterized/table_syntax.rb:38: warning: Refinement#include is deprecated and will be removed in Ruby 3.2
Warning.ignore(%r{rspec-parameterized-table_syntax-1\.0\.0/lib/rspec/parameterized/table_syntax\.rb:\d+: warning: Refinement#include is deprecated})
end
# rubocop:enable Layout/LineLength
......@@ -11,6 +11,8 @@
ENV['GITLAB_ENV'] = 'test'
ENV['IN_MEMORY_APPLICATION_SETTINGS'] = 'true'
require './spec/deprecation_warnings'
# Enable zero monkey patching mode before loading any other RSpec code.
RSpec.configure(&:disable_monkey_patching!)
......
......@@ -7,9 +7,7 @@
abort 'Aborting...'
end
# Enable deprecation warnings by default and make them more visible
# to developers to ease upgrading to newer Ruby versions.
Warning[:deprecated] = true unless ENV.key?('SILENCE_DEPRECATIONS')
require './spec/deprecation_warnings'
require './spec/deprecation_toolkit_env'
DeprecationToolkitEnv.configure!
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册