Class: Use
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- Use
- Includes:
- Downloader
- Defined in:
- lib/test/tc_download.rb
Instance Method Summary collapse
-
#setup ⇒ Object
init …
-
#teardown ⇒ Object
destroy …
- #test_download ⇒ Object
Methods included from Downloader
Instance Method Details
#setup ⇒ Object
init …
7 8 9 10 11 |
# 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 ⇒ Object
destroy …
21 22 23 24 |
# 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 ⇒ Object
12 13 14 15 16 17 18 19 |
# 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.}") end end |