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:
commit
c2ce4d6e14
1 changed files with 8 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue