uploads: switch to active job.

* Switch upload processing from DelayedJob to ActiveJob.
* Remove remaining references to delayed job from tests.

Closes #4128.
This commit is contained in:
evazion
2019-09-23 15:11:18 -05:00
parent 8de6925807
commit 0a6661d145
9 changed files with 30 additions and 36 deletions

View File

@@ -3,8 +3,6 @@ require 'test_helper'
class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
context "The post replacements controller" do
setup do
Delayed::Worker.delay_jobs = true # don't delete the old images right away
@user = create(:moderator_user, can_approve_posts: true, created_at: 1.month.ago)
@user.as_current do
@post = create(:post, source: "https://google.com")
@@ -12,10 +10,6 @@ class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
end
end
teardown do
Delayed::Worker.delay_jobs = false
end
context "create action" do
should "render" do
params = {
@@ -31,9 +25,8 @@ class PostReplacementsControllerTest < ActionDispatch::IntegrationTest
@post.reload
end
travel(PostReplacement::DELETION_GRACE_PERIOD + 1.day) do
Delayed::Worker.new.work_off
end
travel(PostReplacement::DELETION_GRACE_PERIOD + 1.day)
perform_enqueued_jobs
assert_response :success
assert_equal("https://raikou1.donmai.us/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg", @post.source)