Skip to content

Commit

Permalink
Fix postgresql reconnection_error test expects wrong exception
Browse files Browse the repository at this point in the history
  • Loading branch information
nvasilevski committed Feb 6, 2022
1 parent 3da45ea commit 82e90d0
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def exec_params(*)
end

def reset
raise PG::ConnectionBad
raise PG::ConnectionBad, "I'll be rescued by the reconnect method"
end

def close
Expand All @@ -53,8 +53,13 @@ def close
{ host: File::NULL }
)

assert_raises ActiveRecord::ConnectionNotEstablished do
@conn.reconnect!
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!
end

assert_equal("actual bad connection error", error.message)
end
end

Expand Down

0 comments on commit 82e90d0

Please sign in to comment.