1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #44347 from nvasilevski/fix-postgresql-reconnection-test-assertion

Fix postgresql reconnection_error test expects wrong exception
This commit is contained in:
Jean Boussier 2022-02-08 19:18:58 +01:00 committed by GitHub
commit c2ce4d6e14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,7 +39,7 @@ module ActiveRecord
end end
def reset def reset
raise PG::ConnectionBad raise PG::ConnectionBad, "I'll be rescued by the reconnect method"
end end
def close def close
@ -53,9 +53,14 @@ module ActiveRecord
{ host: File::NULL } { host: File::NULL }
) )
assert_raises ActiveRecord::ConnectionNotEstablished do connect_raises_error = proc { |_conn_params| raise(PG::ConnectionBad, "actual bad connection error") }
PG.stub(:connect, connect_raises_error) do
error = assert_raises ActiveRecord::ConnectionNotEstablished do
@conn.reconnect! @conn.reconnect!
end end
assert_equal("actual bad connection error", error.message)
end
end end
def test_bad_connection def test_bad_connection