tests: fix post expungement test.
Delay jobs so the uploaded file isn't deleted immediately (see f6c928e660).
This commit is contained in:
@@ -27,11 +27,16 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
context "Deletion:" do
|
context "Deletion:" do
|
||||||
context "Expunging a post" do
|
context "Expunging a post" do
|
||||||
setup do
|
setup do
|
||||||
|
Delayed::Worker.delay_jobs = true
|
||||||
@upload = UploadService.new(FactoryBot.attributes_for(:jpg_upload)).start!
|
@upload = UploadService.new(FactoryBot.attributes_for(:jpg_upload)).start!
|
||||||
@post = @upload.post
|
@post = @upload.post
|
||||||
Favorite.add(post: @post, user: @user)
|
Favorite.add(post: @post, user: @user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Delayed::Worker.delay_jobs = false
|
||||||
|
end
|
||||||
|
|
||||||
should "delete the files" do
|
should "delete the files" do
|
||||||
assert_nothing_raised { @post.file(:preview) }
|
assert_nothing_raised { @post.file(:preview) }
|
||||||
assert_nothing_raised { @post.file(:original) }
|
assert_nothing_raised { @post.file(:original) }
|
||||||
|
|||||||
Reference in New Issue
Block a user