1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
bogdanvlviv 2018-10-05 14:36:13 +03:00
parent 1ceaf7db50
commit 7e7a6a351c
No known key found for this signature in database
GPG key ID: E4ACD76A6DB6DFDD

View file

@ -170,6 +170,11 @@ module ActiveRecord
ActiveRecord::Base.configurations = config ActiveRecord::Base.configurations = config
ActiveRecord::Base.configurations.configs_for.each do |db_config| ActiveRecord::Base.configurations.configs_for.each do |db_config|
assert_instance_of ActiveRecord::DatabaseConfigurations::HashConfig, 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 end
ensure ensure
ActiveRecord::Base.configurations = @prev_configs ActiveRecord::Base.configurations = @prev_configs