diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-24 01:22:43 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-24 18:20:21 +0300 |
commit | 646685b42cd4cf14f6431633ef1b9f5c2d80ccfc (patch) | |
tree | a38d2ce91ba3e148df17479043c191c3e62033b0 /spec | |
parent | 78b28c3d54b449ab1439d7dfa8fb2f6a20dfbe13 (diff) |
Handle Faraday::ServerError (for example 502) as HTTPFailure
closes #8380
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/connection_tester_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/lib/connection_tester_spec.rb b/spec/lib/connection_tester_spec.rb index a0dce4d4f..d665dd717 100644 --- a/spec/lib/connection_tester_spec.rb +++ b/spec/lib/connection_tester_spec.rb @@ -94,6 +94,11 @@ describe ConnectionTester do expect { tester.request }.to raise_error(ConnectionTester::HTTPFailure) end + it "receives a 502 bad gateway" do + stub_request(:get, url).to_return(status: 502, body: "Bad Gateway!") + expect { tester.request }.to raise_error(ConnectionTester::HTTPFailure) + end + it "cannot connect" do stub_request(:get, url).to_raise(Faraday::ConnectionFailed.new("Error!")) expect { tester.request }.to raise_error(ConnectionTester::NetFailure) |