Downloads::File#http_get_streaming: clean up retry logic.

Replace handrolled retry logic with retriable gem (already pulled in by another gem).
This commit is contained in:
evazion
2018-09-18 02:10:20 -05:00
parent 96e89cecfb
commit d3c135ec72
4 changed files with 29 additions and 43 deletions

View File

@@ -10,14 +10,9 @@ module Downloads
end
context "that fails" do
setup do
HTTParty.stubs(:get).raises(Errno::ETIMEDOUT)
end
should "retry three times" do
assert_raises(Errno::ETIMEDOUT) do
@download.http_get_streaming(@source, @tempfile)
end
should "retry three times before giving up" do
HTTParty.expects(:get).times(3).raises(Errno::ETIMEDOUT)
assert_raises(Errno::ETIMEDOUT) { @download.download! }
end
end