tinami/pixa downloads now supported

This commit is contained in:
albert
2011-09-30 14:27:04 -04:00
parent 2287bc8d61
commit aa2b65c48b
13 changed files with 326 additions and 170 deletions

View File

@@ -0,0 +1,35 @@
require 'test_helper'
module Downloads
class PixivTest < ActiveSupport::TestCase
context "a download for a pixiv manga page" do
setup do
@source = "http://img65.pixiv.net/img/kiyoringo/21755794_p2.png"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
@download.download!
end
should "instead download the big version" do
assert_equal("http://img65.pixiv.net/img/kiyoringo/21755794_big_p2.png", @download.source)
end
end
context "a download for a small image" do
setup do
@source = "http://img02.pixiv.net/img/wanwandoh/4348318_m.jpg"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
@download.download!
end
should "instead download the original version" do
assert_equal("http://img02.pixiv.net/img/wanwandoh/4348318.jpg", @download.source)
end
should "work" do
assert_equal(185778, ::File.size(@tempfile.path))
end
end
end
end