From 7e7a6a351c4845d8d92238147450b22fe87627f9 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Fri, 5 Oct 2018 14:36:13 +0300 Subject: [PATCH] Exercise stringify of database configurations Since #33968 we stringify keys of database configuration This commit adds more assertions in order to ensure that and prevent any regression in the future. Currently, if remove `to_s` added in #33968 from `env_name.to_s` on the line (activerecord/lib/active_record/database_configurations.rb:107), there is no test that would fail. One of the added assertions should emphasize why we need this `to_s`. Follow up #33968 --- .../cases/connection_adapters/connection_handler_test.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb index 5e3447efde..51d0cc3d12 100644 --- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb @@ -170,6 +170,11 @@ module ActiveRecord ActiveRecord::Base.configurations = config ActiveRecord::Base.configurations.configs_for.each do |db_config| assert_instance_of ActiveRecord::DatabaseConfigurations::HashConfig, db_config + assert_instance_of String, db_config.env_name + assert_instance_of String, db_config.spec_name + db_config.config.keys.each do |key| + assert_instance_of String, key + end end ensure ActiveRecord::Base.configurations = @prev_configs