提交 d0e95f45 编写于 作者: J John Hawthorn

Raise TypeError instead of infinite looping

上级 2e6d9af6
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册