posts: fix expunging posts not deleting files.

Fix expungement to ignore the "file still in use" check.
This commit is contained in:
evazion
2017-06-14 20:02:32 -05:00
parent 24ad435067
commit a844a1daf4
5 changed files with 30 additions and 7 deletions

View File

@@ -48,6 +48,7 @@ class ActionController::TestCase
end
Delayed::Worker.delay_jobs = false
TestAfterCommit.enabled = false
require "helpers/reportbooru_helper"
class ActiveSupport::TestCase

View File

@@ -33,7 +33,23 @@ class PostTest < ActiveSupport::TestCase
context "Deletion:" do
context "Expunging a post" do
setup do
@post = FactoryGirl.create(:post)
@upload = FactoryGirl.create(:jpg_upload)
@upload.process!
@post = @upload.post
end
should "delete the files" do
assert_equal(true, File.exists?(@post.preview_file_path))
assert_equal(true, File.exists?(@post.large_file_path))
assert_equal(true, File.exists?(@post.file_path))
TestAfterCommit.with_commits(true) do
@post.expunge!
end
assert_equal(false, File.exists?(@post.preview_file_path))
assert_equal(false, File.exists?(@post.large_file_path))
assert_equal(false, File.exists?(@post.file_path))
end
context "that is status locked" do