Skip to content

Commit

Permalink
Exercise stringify of database configurations
Browse files Browse the repository at this point in the history
Since rails#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 rails#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 rails#33968
  • Loading branch information
bogdanvlviv committed Oct 5, 2018
1 parent 1ceaf7d commit 7e7a6a3
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -170,6 +170,11 @@ def test_symbolized_configurations_assignment
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
Expand Down

0 comments on commit 7e7a6a3

Please sign in to comment.