aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-07 19:16:20 -0300
committerMatthew Draper <matthew@trebex.net>2014-04-08 15:15:00 +0930
commitd459f751c934529e6a3cff36554a02d6ce7666f4 (patch)
tree80d453878be5a91a00c9b17741d881da9947cd94 /activerecord/test/cases
parente533826f483d6a1f45d044a2017ff4e9d19a154e (diff)
downloadrails-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.rb9
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" } }