Sha256: 1e2ca61523b2275403022908089e3f58d0609fedbf67a0b0529feb96155ee466
Contents?: true
Size: 1.19 KB
Versions: 30
Compression:
Stored size: 1.19 KB
Contents
# -*- coding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe Kindai::SpreadDownloader do before do @book = Kindai::Book.new_from_permalink('http://kindai.ndl.go.jp/info:ndljp/pid/922693') @spread = @book.spreads[10] @downloader = Kindai::SpreadDownloader.new_from_spread(@spread) end it 'has spread' do @downloader.spread.should == @spread end it 'has retry_count' do @downloader.retry_count.should == 30 @downloader.retry_count = 50 @downloader.retry_count.should == 50 end it 'has spread path' do @downloader.book_path = "/path/to/book" @downloader.spread_path.should == "/path/to/book/original/011.jpg" end it 'can download spread' do book_path = File.join(ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] || '/tmp', rand.to_s) Dir.mkdir(book_path) @downloader.book_path = book_path @downloader.has_file?.should be_false @downloader.download.should be_true @downloader.has_file?.should be_true @downloader.download.should be_false @downloader.delete.should be_true FileUtils.rm_r book_path @downloader.has_file?.should be_false @downloader.delete.should be_false end end
Version data entries
30 entries across 30 versions & 1 rubygems