提交 8f23c220 编写于 作者: M Matthew Draper

Ensure we correctly and immediately load all ENV entries

.. even when the supplied config made no hint that name was relevant.
上级 23692184
......@@ -70,6 +70,14 @@ def test_resolver_with_database_uri_and_known_key
assert_equal expected, actual
end
def test_resolver_with_custom_database_uri_and_no_matching_config
ENV['DATABASE_URL_PRODUCTION'] = "postgres://localhost/foo"
config = {}
actual = resolve(:production, config)
expected = { "adapter"=>"postgresql", "database"=>"foo", "host"=>"localhost" }
assert_equal expected, actual
end
def test_resolver_with_custom_database_uri_and_custom_key
ENV['DATABASE_URL_PRODUCTION'] = "postgres://localhost/foo"
config = { "production" => { "adapter" => "not_postgres", "database" => "not_foo", "host" => "localhost" } }
......@@ -118,6 +126,19 @@ def test_environment_does_not_exist_in_config_url_does_exist
assert_equal expect_prod, actual["default_env"]
end
def test_environment_key_available_immediately
ENV['DATABASE_URL_PRODUCTION'] = "postgres://localhost/foo"
config = {}
actual = klass.new(config).resolve
expected = { "production" =>
{ "adapter" => "postgresql",
"database" => "foo",
"host" => "localhost"
}
}
assert_equal expected, actual
end
def test_string_connection
config = { "default_env" => "postgres://localhost/foo" }
actual = klass.new(config).resolve
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册