# Turning Off Ruby Deprecation Warnings When Running Tests

DevFeed: [Turning Off Ruby Deprecation Warnings When Running Tests](<https://devfeed.tech/articles/turning-off-ruby-deprecation-warnings-when-running-tests-28259.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2020/01/28/turning-off-ruby-deprecation-warnings-when-running-tests.html>)

Author: Fuzzygroup

Published: 2020-01-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [test](<https://devfeed.tech/topics/test.md>), [deprecated](<https://devfeed.tech/topics/deprecated.md>)

Tags: [deprecated](<https://devfeed.tech/tags/deprecated.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [test](<https://devfeed.tech/tags/test.md>), [tests](<https://devfeed.tech/tags/tests.md>)

## AI overview

A Rails 6 and Ruby 2.7 project can silence deprecation warnings during tests by setting `$VERBOSE=nil` in `config/environments/test.rb`. The article also notes that `RUBYOPT="-W0"` works with `rake` but not with `rails` for running tests.

## Source excerpt

The combination of Rails 6 and Ruby 2.7, or perhaps just Rails 6, introduced some new deprecation warnings and, lately, I've been seeing this cruft constantly: rails test test/models/ Running via Spring preloader in process 34024 /Users/sjohnson/.rvm/gems/ruby-2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/sjohnson/.rvm/gems/ruby-2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here /Users/sjohnson/.rvm/gems/ruby-2.7.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb:12: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /Users/sjohnson/.rvm/gems/ruby-2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here And, in the immortal words of Twisted Sister, we're not going to take it anymore. The solution is a bit more byzantine than I have found in the Rails world and a bunch of the options in the Stack Overflow "top of Google" but no longer accurate post no longer work or aren't quite what you expect. The easy solution is to add: $VERBOSE=nil to the top of config/environments/test.rb so it looks like this: $VERBOSE=nil Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = false Obviously the rest of the file has to be there but that $VERBOSE=nil silences all the cruft. One other solution, RUBYOPT="-W0", prepended before you run the test doesn't work