FIX: Don't raise an error if reading from URL timeout.
This commit is contained in:
parent
a311dd06fe
commit
5324c01209
|
@ -123,6 +123,8 @@ class FinalDestination
|
||||||
return resolve
|
return resolve
|
||||||
end
|
end
|
||||||
|
|
||||||
|
nil
|
||||||
|
rescue Excon::Errors::Timeout
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,17 @@ describe FinalDestination do
|
||||||
expect(fd('https://eviltrout.com').status).to eq(:ready)
|
expect(fd('https://eviltrout.com').status).to eq(:ready)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns nil an invalid url" do
|
it "returns nil for an invalid url" do
|
||||||
expect(fd(nil).resolve).to be_nil
|
expect(fd(nil).resolve).to be_nil
|
||||||
expect(fd('asdf').resolve).to be_nil
|
expect(fd('asdf').resolve).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "returns nil when read timeouts" do
|
||||||
|
Excon.expects(:public_send).raises(Excon::Errors::Timeout)
|
||||||
|
|
||||||
|
expect(fd('https://discourse.org').resolve).to eq(nil)
|
||||||
|
end
|
||||||
|
|
||||||
context "without redirects" do
|
context "without redirects" do
|
||||||
before do
|
before do
|
||||||
stub_request(:head, "https://eviltrout.com").to_return(doc_response)
|
stub_request(:head, "https://eviltrout.com").to_return(doc_response)
|
||||||
|
|
Loading…
Reference in New Issue