class Use

Public Instance Methods

setup() click to toggle source

init …

# File lib/test/tc_download.rb, line 7
def setup()
    @dir = "./img"
    @direxist = Dir.exist?(@dir)
    @test_src = 'https://w.wallhaven.cc/full/r2/wallhaven-r2qqlj.jpg'
end
teardown() click to toggle source

destroy …

# File lib/test/tc_download.rb, line 21
def teardown()
    File.delete(self.placed) if self.placed && File.exist?(self.placed)
    Dir.rmdir(@dir) unless @direxist
end
test_download() click to toggle source
# File lib/test/tc_download.rb, line 12
def test_download()
    begin
        self.download(@test_src)
        assert(File.exist?(self.placed), 'download failed')
    rescue => exception
        assert(false, "download exception: #{exception.message}")
    end
end