spec/ethon/easy/options_spec.rb in ethon-0.7.3 vs spec/ethon/easy/options_spec.rb in ethon-0.7.4

- old
+ new

@@ -102,13 +102,13 @@ expect(easy.return_code).to eq(:couldnt_connect) end end end - if Ethon::Curl.version.match("c-ares") + if Ethon::Easy.supports_timeout_ms? context "when timeout_ms" do - let(:timeout_ms) { 900 } + let(:timeout_ms) { 100 } context "when request takes longer" do let(:url) { "localhost:3001?delay=1" } it "times out" do @@ -116,16 +116,17 @@ end end end context "when connecttimeout_ms" do - let(:connecttimeout_ms) { 1 } + let(:connecttimeout_ms) { 100 } context "when cannot connect" do let(:url) { "localhost:3002" } it "times out" do - expect(easy.return_code).to eq(:couldnt_connect) + # this can either lead to a timeout or couldnt connect depending on which happens first + expect([:couldnt_connect, :operation_timedout]).to include(easy.return_code) end end end end end