add test case for download retry

This commit is contained in:
albert
2013-03-22 19:15:12 -04:00
parent a4b67fa072
commit d1127da13f
2 changed files with 14 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ module Downloads
class File
class Error < Exception ; end
attr_reader :tries
attr_accessor :source, :content_type, :file_path
def initialize(source, file_path)
@@ -77,7 +78,6 @@ module Downloads
end # http.request_get
end # http.start
rescue Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EIO, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, IOError => x
puts x.inspect
@tries += 1
if @tries < 3
retry