From dc41531c09448fbd83ff8b66cb3f4ee8e4fb761f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 23 Sep 2024 10:09:18 -0400 Subject: [PATCH] Pull out `row_worker_job_args` in bulk import service spec --- spec/services/bulk_import_service_spec.rb | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/spec/services/bulk_import_service_spec.rb b/spec/services/bulk_import_service_spec.rb index 09937ad4978..3bd834d7a78 100644 --- a/spec/services/bulk_import_service_spec.rb +++ b/spec/services/bulk_import_service_spec.rb @@ -34,7 +34,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows.map(&:id)) + expect(row_worker_job_args).to match_array(rows.map(&:id)) end it 'requests to follow all the listed users once the workers have run' do @@ -79,7 +79,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows[1..].map(&:id)) + expect(row_worker_job_args).to match_array(rows[1..].map(&:id)) end it 'requests to follow all the expected users once the workers have run' do @@ -114,7 +114,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows.map(&:id)) + expect(row_worker_job_args).to match_array(rows.map(&:id)) end it 'blocks all the listed users once the workers have run' do @@ -155,7 +155,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows[1..].map(&:id)) + expect(row_worker_job_args).to match_array(rows[1..].map(&:id)) end it 'requests to follow all the expected users once the workers have run' do @@ -190,7 +190,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows.map(&:id)) + expect(row_worker_job_args).to match_array(rows.map(&:id)) end it 'mutes all the listed users once the workers have run' do @@ -235,7 +235,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows[1..].map(&:id)) + expect(row_worker_job_args).to match_array(rows[1..].map(&:id)) end it 'requests to follow all the expected users once the workers have run' do @@ -331,7 +331,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows.map(&:id)) + expect(row_worker_job_args).to match_array(rows.map(&:id)) end it 'updates the bookmarks as expected once the workers have run' do @@ -371,7 +371,7 @@ RSpec.describe BulkImportService do it 'enqueues workers for the expected rows' do subject.call(import) - expect(Import::RowWorker.jobs.pluck('args').flatten).to match_array(rows.map(&:id)) + expect(row_worker_job_args).to match_array(rows.map(&:id)) end it 'updates the bookmarks as expected once the workers have run' do @@ -385,6 +385,13 @@ RSpec.describe BulkImportService do end end + def row_worker_job_args + Import::RowWorker + .jobs + .pluck('args') + .flatten + end + def stub_resolve_account_service resolve_account_service_double = instance_double(ResolveAccountService)