diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-07 19:16:20 -0300 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-04-08 15:15:00 +0930 |
commit | d459f751c934529e6a3cff36554a02d6ce7666f4 (patch) | |
tree | 80d453878be5a91a00c9b17741d881da9947cd94 /activerecord/test/cases | |
parent | e533826f483d6a1f45d044a2017ff4e9d19a154e (diff) | |
download | rails-d459f751c934529e6a3cff36554a02d6ce7666f4.tar.gz rails-d459f751c934529e6a3cff36554a02d6ce7666f4.tar.bz2 rails-d459f751c934529e6a3cff36554a02d6ce7666f4.zip |
Test DATABASE_URL has precendance over DATABASE_URL_#{environment}
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/connection_adapters/connection_handler_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb index aec70fac79..ae4172f15c 100644 --- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb @@ -45,6 +45,15 @@ module ActiveRecord assert_equal expected, actual end + def test_resolver_with_environment_database_uri_and_global_database_uri_and_current_env_symbol_key + ENV['DATABASE_URL'] = "postgres://localhost/foo" + ENV['DATABASE_URL_DEFAULT_ENV'] = "mysql://host/foo_bar" + config = { "default_env" => { "adapter" => "not_postgres", "database" => "not_foo" } } + actual = resolve(:default_env, config) + expected = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost" } + assert_equal expected, actual + end + def test_resolver_with_database_uri_and_and_current_env_string_key ENV['DATABASE_URL'] = "postgres://localhost/foo" config = { "default_env" => { "adapter" => "not_postgres", "database" => "not_foo" } } |