ruby-on-railsrspecrails-activerecordrspec-railsmoney-rails

connection_config deprecated warning with RSpec after migrating to Rails 6.1


I upgraded an app to Rails 6.1.0 (from 6.0.3.3, by creating a new api-only app, adding RSpec, then copying needed files over manually).

I am seeing the following warning when I run RSpec:

DEPRECATION WARNING: connection_config is deprecated and will be removed from Rails 6.2 (Use 
connection_db_config instead) (called from <top (required)> at 
[...app/models/application_record.rb:1].

I did not change the ApplicationRecord class from the default:

class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
end

I only see this warning when I run RSpec. I have not seen it in the rails console or in the Rails server log.

Here is my config/database.yml:

default: &default
  adapter: postgresql
  encoding: unicode
  host: <%= ENV.fetch('DATABASE_HOST', 'localhost') %>
  username: <%= ENV.fetch('POSTGRES_USER', 'postgres') %>
  password: <%= ENV.fetch('POSTGRES_PASSWORD', '') %>
  database: <%= ENV.fetch('POSTGRES_DB', 'myapp_development') %>
  pool: 5
  timeout: 5000

development:
  <<: *default

test:
  <<: *default
database: myapp_test

production:
  <<: *default

Any suggestions on how to get rid of this?


Solution

  • After further debugging I was able to trace it to the money-rails gem.

    https://github.com/RubyMoney/money-rails/issues/601