diff --git a/app/views/delayed_jobs/index.html.erb b/app/views/delayed_jobs/index.html.erb
index 1ed783f36..00482f9f5 100644
--- a/app/views/delayed_jobs/index.html.erb
+++ b/app/views/delayed_jobs/index.html.erb
@@ -24,7 +24,7 @@
<%= time_ago_in_words_tagged(job.run_at) %>
<% end %>
<% t.column column: "control" do |job| %>
- <% if policy(job).update? %>
+ <% if DelayedJobPolicy.new([CurrentUser.user, request], job).update? %>
<% if job.locked_at? %>
Running
<% elsif job.failed? %>
diff --git a/test/factories/delayed_job.rb b/test/factories/delayed_job.rb
new file mode 100644
index 000000000..4a617fec0
--- /dev/null
+++ b/test/factories/delayed_job.rb
@@ -0,0 +1,5 @@
+FactoryBot.define do
+ factory :delayed_job, class: Delayed::Job do
+ handler { "" }
+ end
+end
diff --git a/test/functional/delayed_jobs_controller_test.rb b/test/functional/delayed_jobs_controller_test.rb
index dc320b425..eefd2d996 100644
--- a/test/functional/delayed_jobs_controller_test.rb
+++ b/test/functional/delayed_jobs_controller_test.rb
@@ -4,6 +4,7 @@ class DelayedJobsControllerTest < ActionDispatch::IntegrationTest
context "The delayed jobs controller" do
context "index action" do
should "render" do
+ create(:delayed_job)
get delayed_jobs_path
assert_response :success
end