Skip to content

Commit

Permalink
Merge pull request #36848 from jhawthorn/type_error_on_resolve_connec…
Browse files Browse the repository at this point in the history
…tion

Raise TypeError instead of infinite loop in resolve_connection
  • Loading branch information
jhawthorn committed Aug 7, 2019
2 parents d44fdd2 + d0e95f4 commit ec2dcdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -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

Expand Down
Expand Up @@ -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
Expand Down

0 comments on commit ec2dcdd

Please sign in to comment.