迁移到 Rails 6.1 后,connection_config 已弃用 RSpec 警告

Mar*_*ser 5 rspec ruby-on-rails rspec-rails rails-activerecord money-rails

我将一个应用程序升级到 Rails 6.1.0(从 6.0.3.3 开始,通过创建一个新的仅 api 应用程序,添加 RSpec,然后手动复制所需的文件)。

当我运行 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].
Run Code Online (Sandbox Code Playgroud)

我没有更改ApplicationRecord默认的类:

class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
end
Run Code Online (Sandbox Code Playgroud)

我仅在运行 RSpec 时看到此警告。我没有在 Rails 控制台或 Rails 服务器日志中看到它。

这是我的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
Run Code Online (Sandbox Code Playgroud)

关于如何摆脱这个问题有什么建议吗?

Mar*_*ser 5

经过进一步调试,我能够将其追踪到money-rails宝石。

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