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:
commit
ec2dcddf79
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user