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

@@ -8,7 +8,7 @@ RUN apt-get update && \
wget -q https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
apt-get -y install -qq apt-utils build-essential automake libssl-dev libxml2-dev libxslt-dev ncurses-dev sudo libreadline-dev flex bison ragel memcached libmemcached-dev git curl libcurl4-openssl-dev imagemagick libmagickcore-dev libmagickwand-dev sendmail-bin sendmail postgresql-client libpq-dev nginx ssh coreutils ffmpeg mkvtoolnix emacs24-nox telnet && \
apt-get -y install -qq apt-utils build-essential automake libssl-dev libxml2-dev libxslt-dev ncurses-dev sudo libreadline-dev flex bison ragel memcached libmemcached-dev git curl libcurl4-openssl-dev imagemagick libmagickcore-dev libmagickwand-dev sendmail-bin sendmail postgresql-client libpq-dev nginx ssh coreutils ffmpeg mkvtoolnix emacs24-nox telnet libgif-dev && \
apt-get clean && \
cd /tmp && \
wget -q https://github.com/jcupitt/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz && \

View File

@@ -7,7 +7,7 @@ class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
@user = create(:moderator_user, can_approve_posts: true, created_at: 1.month.ago)
@user.as_current do
@post = create(:post)
@post = create(:post, source: "https://google.com")
@post_replacement = create(:post_replacement, post: @post)
end
end
@@ -22,7 +22,7 @@ class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
format: :json,
post_id: @post.id,
post_replacement: {
replacement_url: "https://www.google.com/intl/en_ALL/images/logo.gif",
replacement_url: "https://raikou1.donmai.us/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg",
}
}
@@ -36,9 +36,9 @@ class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
end
assert_response :success
assert_equal("https://www.google.com/intl/en_ALL/images/logo.gif", @post.source)
assert_equal("e80d1c59a673f560785784fb1ac10959", @post.md5)
assert_equal("e80d1c59a673f560785784fb1ac10959", Digest::MD5.file(@post.file(:original)).hexdigest)
assert_equal("https://raikou1.donmai.us/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg", @post.source)
assert_equal("d34e4cf0a437a5d65f8e82b7bcd02606", @post.md5)
assert_equal("d34e4cf0a437a5d65f8e82b7bcd02606", Digest::MD5.file(@post.file(:original)).hexdigest)
end
end

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