我用的 rails 版本是 6.0.5.1,gem 引用了 gem 'database_cleaner', '~> 1.5.3',gem 'rspec-rails', '~> 5.0.0',用 rspec 命令进行单元测试出现一个错误
DEPRECATION WARNING: Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper.
Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.
Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload ActionText::ContentHelper, for example,
the expected changes won't be reflected in that stale Module object.
These autoloaded constants have been unloaded.
Please, check the "Autoloading and Reloading Constants" guide for solutions.
(called from <top (required)> at /home/henry/projects/master_actions/config/environment.rb:5)
An error occurred in a `before(:suite)` hook.
Failure/Error: DatabaseCleaner.clean_with(:truncation)
NoMethodError:
undefined method `schema_migrations_table_name' for ActiveRecord::Migrator:Class
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/active_record/truncation.rb:260:in `migration_storage_names'
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/generic/truncation.rb:14:in `initialize'
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/base.rb:39:in `new'
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/base.rb:39:in `create_strategy'
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/base.rb:43:in `clean_with'
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/configuration.rb:91:in `block in clean_with'
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/configuration.rb:91:in `each'
# /usr/share/rvm/gems/ruby-2.7.0/gems/database_cleaner-1.5.3/lib/database_cleaner/configuration.rb:91:in `clean_with'
# ./spec/spec_helper.rb:50:in `block (2 levels) in <top (required)>'
Finished in 0.02272 seconds (files took 1.25 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
查了一下,好像是 database_cleaner 的版本不对。那么我如何判断某个版本的 rails 该用哪个版本的 gem 呢?