From 0f2e6a9a1b586469193ee278f78ce25db01a038b Mon Sep 17 00:00:00 2001 From: Albert Yi Date: Wed, 9 May 2018 12:45:37 -0700 Subject: [PATCH] fix tests --- config/docker/danbooru-base | 2 -- test/unit/post_test.rb | 12 ++++++++---- test/unit/upload_test.rb | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/config/docker/danbooru-base b/config/docker/danbooru-base index a31787a8e..df05e6c38 100644 --- a/config/docker/danbooru-base +++ b/config/docker/danbooru-base @@ -1,5 +1,3 @@ -# This sets up a docker container suitable for use with Travis CI - FROM ruby:2.5.1-slim-stretch RUN apt-get update diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 330ab99d9..177bab802 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -2089,7 +2089,7 @@ class PostTest < ActiveSupport::TestCase end should "return posts for the date: metatag" do - post = FactoryBot.create(:post, created_at: Time.parse("2017-01-01")) + post = FactoryBot.create(:post, created_at: Time.parse("2017-01-01 12:00")) assert_tag_match([post], "date:2017-01-01") end @@ -2621,9 +2621,13 @@ class PostTest < ActiveSupport::TestCase setup do PostArchive.sqs_service.stubs(:merge?).returns(false) @post = FactoryBot.create(:post, :rating => "q", :tag_string => "aaa", :source => "") - @post.update_attributes(:tag_string => "aaa bbb ccc ddd") - @post.update_attributes(:tag_string => "bbb xxx yyy", :source => "xyz") - @post.update_attributes(:tag_string => "bbb mmm yyy", :source => "abc") + @post.reload + @post.update(:tag_string => "aaa bbb ccc ddd") + @post.reload + @post.update(:tag_string => "bbb xxx yyy", :source => "xyz") + @post.reload + @post.update(:tag_string => "bbb mmm yyy", :source => "abc") + @post.reload end context "and then reverted to an early version" do diff --git a/test/unit/upload_test.rb b/test/unit/upload_test.rb index 5bb86a3eb..047dfce2d 100644 --- a/test/unit/upload_test.rb +++ b/test/unit/upload_test.rb @@ -264,7 +264,8 @@ class UploadTest < ActiveSupport::TestCase upload = FactoryBot.create(:upload, rating: "s", file: upload_file("test/files/test-512x512.webm")) assert_difference("Post.count") do - assert_nothing_raised { upload.process! } + upload.process! + assert_equal("completed", upload.status) end post = Post.last @@ -283,7 +284,8 @@ class UploadTest < ActiveSupport::TestCase upload = FactoryBot.create(:upload, rating: "s", file: upload_file("test/files/test-300x300.mp4")) assert_difference("Post.count") do - assert_nothing_raised { upload.process! } + upload.process! + assert_equal("completed", upload.status) end post = Post.last