Skip to content

Commit 0672d1f

Browse files
authored
Merge pull request #4831 from nhsuk/rename-wait-for-jobs-to-finish
Rename `wait_for_jobs_to_finish`
2 parents 5036af9 + 5a5f96c commit 0672d1f

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

spec/jobs/pds_cascading_search_job_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
it "skips wildcard name steps and completes search" do
128128
described_class.perform_now(patient_changeset)
129129

130-
wait_for_jobs_to_finish(described_class.to_s)
130+
perform_enqueued_jobs_while_exists(only: described_class)
131131
perform_enqueued_jobs(only: ProcessPatientChangesetJob)
132132

133133
patient_changeset.reload

spec/support/imports_helper.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module ImportsHelper
44
def wait_for_import_to_complete(import_class)
55
perform_enqueued_jobs(only: ProcessImportJob)
66

7-
wait_for_jobs_to_finish("PDSCascadingSearchJob")
8-
wait_for_jobs_to_finish("ProcessPatientChangesetJob")
7+
perform_enqueued_jobs_while_exists(only: PDSCascadingSearchJob)
8+
perform_enqueued_jobs_while_exists(only: ProcessPatientChangesetJob)
99

1010
perform_enqueued_jobs(only: CommitPatientChangesetsJob)
1111
click_on_most_recent_import(import_class)
@@ -16,10 +16,12 @@ def click_on_most_recent_import(import_class)
1616
match: :first
1717
end
1818

19-
def wait_for_jobs_to_finish(job_class)
19+
def perform_enqueued_jobs_while_exists(only:)
20+
job_class = only.name
21+
2022
# rubocop:disable Style/WhileUntilModifier
2123
while enqueued_jobs.any? { it["job_class"] == job_class }
22-
perform_enqueued_jobs(only: job_class.constantize)
24+
perform_enqueued_jobs(only:)
2325
end
2426
# rubocop:enable Style/WhileUntilModifier
2527
end

0 commit comments

Comments
 (0)