Commit e147ce0f authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'bvl-missing-related-class' into 'master'

Pass related_class to the context as a string

See merge request gitlab-org/gitlab!28576
parents de6095a0 75520ee1
...@@ -15,7 +15,7 @@ class ReactiveCachingWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -15,7 +15,7 @@ class ReactiveCachingWorker # rubocop:disable Scalability/IdempotentWorker
def self.context_for_arguments(arguments) def self.context_for_arguments(arguments)
class_name, *_other_args = arguments class_name, *_other_args = arguments
Gitlab::ApplicationContext.new(related_class: class_name) Gitlab::ApplicationContext.new(related_class: class_name.to_s)
end end
def perform(class_name, id, *args) def perform(class_name, id, *args)
......
...@@ -37,5 +37,13 @@ describe ReactiveCachingWorker do ...@@ -37,5 +37,13 @@ describe ReactiveCachingWorker do
expect(scheduled_job).to include('meta.related_class' => 'Environment') expect(scheduled_job).to include('meta.related_class' => 'Environment')
end end
it 'sets the related class on the job when it was passed as a class' do
described_class.perform_async(Project, 1, 'other', 'argument')
scheduled_job = described_class.jobs.first
expect(scheduled_job).to include('meta.related_class' => 'Project')
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment