Merge pull request #36848 from jhawthorn/type_error_on_resolve_connection

Raise TypeError instead of infinite loop in resolve_connection
This commit is contained in:
John Hawthorn 2019-08-07 14:51:26 -07:00 committed by GitHub
commit ec2dcddf79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

@ -221,7 +221,7 @@ def resolve_connection(config_or_env, pool_name = nil)
when Hash
resolve_hash_connection config_or_env
else
resolve_connection config_or_env
raise TypeError, "Invalid type for configuration. Expected Symbol, String, or Hash. Got #{config_or_env.inspect}"
end
end

@ -135,6 +135,12 @@ def test_spec_name_with_inline_config
spec = spec("adapter" => "sqlite3")
assert_equal "primary", spec.name, "should default to primary id"
end
def test_spec_with_invalid_type
assert_raises TypeError do
spec(Object.new)
end
end
end
end
end