fix specs

This commit is contained in:
Albert Yi
2018-07-02 14:53:21 -07:00
parent 867406f410
commit 7f895bd91f
3 changed files with 16 additions and 8 deletions

View File

@@ -734,10 +734,18 @@ class UploadServiceTest < ActiveSupport::TestCase
as_user do
@post1.replace!(replacement_url: "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=62247350")
@post2.replace!(replacement_url: "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=62247364")
@post2.replace!(replacement_url: "https://www.google.com/intl/en_ALL/images/logo.gif")
assert_equal("4ceadc314938bc27f3574053a3e1459a", @post1.md5)
assert_equal("cad1da177ef309bf40a117c17b8eecf5", @post2.md5)
@post2.reload
@post2.replace!(replacement_url: "https://raikou1.donmai.us/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg")
assert_equal("d34e4cf0a437a5d65f8e82b7bcd02606", @post2.md5)
Upload.destroy_all
@post1.reload
@post2.reload
@post1.replace!(replacement_url: "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=62247364")
@post2.replace!(replacement_url: "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=62247350")
assert_equal("cad1da177ef309bf40a117c17b8eecf5", @post1.md5)
assert_equal("4ceadc314938bc27f3574053a3e1459a", @post2.md5)
end
Timecop.travel(Time.now + PostReplacement::DELETION_GRACE_PERIOD + 1.day) do
@@ -830,7 +838,7 @@ class UploadServiceTest < ActiveSupport::TestCase
end
should "should fail validation" do
service = subject.new(file: upload_file("test/files/test-static-32x32.gif"))
service = subject.new(file: upload_file("test/files/test-large.jpg"))
upload = service.start!
assert_match(/image resolution is too large/, upload.status)
end