aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/connection_adapters/connection_handler_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/connection_adapters/connection_handler_test.rb')
-rw-r--r--activerecord/test/cases/connection_adapters/connection_handler_test.rb23
1 files changed, 8 insertions, 15 deletions
diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
index 318cc5a32c..599e8c762c 100644
--- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb
+++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
@@ -17,6 +17,14 @@ module ActiveRecord
ENV["DATABASE_URL"] = @previous_database_url
end
+ def test_environment_does_not_exist_in_config_url_does_exist
+ ENV['DATABASE_URL'] = "postgres://localhost/foo"
+ config = { "not_production" => { "adapter" => "not_postgres", "database" => "not_foo" } }
+ actual = klass.new(config).resolve
+ expect_prod = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost" }
+ assert_equal expect_prod, actual["production"]
+ end
+
def test_string_connection
config = { "production" => "postgres://localhost/foo" }
actual = klass.new(config).resolve
@@ -69,21 +77,6 @@ module ActiveRecord
assert_equal nil, actual[:test]
end
- def test_sting_with_database_url
- ENV['DATABASE_URL'] = "NOT-POSTGRES://localhost/NOT_FOO"
-
- config = { "production" => "postgres://localhost/foo" }
- actual = klass.new(config).resolve
-
- expected = { "production" =>
- { "adapter" => "postgresql",
- "database" => "foo",
- "host" => "localhost"
- }
- }
- assert_equal expected, actual
- end
-
def test_url_sub_key_with_database_url
ENV['DATABASE_URL'] = "NOT-POSTGRES://localhost/NOT_FOO"