Commit 238bfe3a authored by Peter Leitzen's avatar Peter Leitzen Committed by Thong Kuah

Enable Ruby deprecation warnings in RSpec by default

You can silence warnings via envvar SILENCE_DEPRECATIONS
parent 6d33b2c8
...@@ -50,6 +50,22 @@ bundle exec guard ...@@ -50,6 +50,22 @@ bundle exec guard
When using spring and guard together, use `SPRING=1 bundle exec guard` instead to make use of spring. When using spring and guard together, use `SPRING=1 bundle exec guard` instead to make use of spring.
### Ruby warnings
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47767) in GitLab 13.7.
We've enabled [deprecation warnings](https://ruby-doc.org/core-2.7.2/Warning.html)
by default when running specs. Making these warnings more visible to developers
helps upgrading to newer Ruby versions.
You can silence deprecation warnings by setting the environment variable
`SILENCE_DEPRECATIONS`, for example:
```shell
# silence all deprecation warnings
SILENCE_DEPRECATIONS=1 bin/rspec spec/models/project_spec.rb
```
### Test speed ### Test speed
GitLab has a massive test suite that, without [parallelization](ci.md#test-suite-parallelization-on-the-ci), can take hours GitLab has a massive test suite that, without [parallelization](ci.md#test-suite-parallelization-on-the-ci), can take hours
......
...@@ -8,6 +8,10 @@ if $".include?(File.expand_path('fast_spec_helper.rb', __dir__)) ...@@ -8,6 +8,10 @@ if $".include?(File.expand_path('fast_spec_helper.rb', __dir__))
abort 'Aborting...' abort 'Aborting...'
end 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_toolkit_env' require './spec/deprecation_toolkit_env'
require './spec/simplecov_env' require './spec/simplecov_env'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment