tests: fix post expungement test.

Delay jobs so the uploaded file isn't deleted immediately (see f6c928e660).
This commit is contained in:
evazion
2018-10-06 00:58:22 -05:00
parent 1e710e1ae0
commit 9301bf2f11

View File

@@ -27,11 +27,16 @@ class PostTest < ActiveSupport::TestCase
context "Deletion:" do
context "Expunging a post" do
setup do
Delayed::Worker.delay_jobs = true
@upload = UploadService.new(FactoryBot.attributes_for(:jpg_upload)).start!
@post = @upload.post
Favorite.add(post: @post, user: @user)
end
teardown do
Delayed::Worker.delay_jobs = false
end
should "delete the files" do
assert_nothing_raised { @post.file(:preview) }
assert_nothing_raised { @post.file(:original) }