From 7e1ae28514124fe4e747a7b6512eb98abecc7ac9 Mon Sep 17 00:00:00 2001 From: Ynda Jas Date: Thu, 30 May 2024 19:08:46 +0100 Subject: [PATCH] Break down `BulkRepublisher` test Breaking these assertions into multiple tests makes it a little easier to parse --- .../app/services/bulk_republisher_test.rb | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/unit/app/services/bulk_republisher_test.rb b/test/unit/app/services/bulk_republisher_test.rb index fca5cfd0a751..a7c29cb7f1f4 100644 --- a/test/unit/app/services/bulk_republisher_test.rb +++ b/test/unit/app/services/bulk_republisher_test.rb @@ -50,15 +50,6 @@ class BulkRepublisherTest < ActiveSupport::TestCase describe "#republish_all_documents_with_pre_publication_editions" do test "queues all documents with pre-publication editions for republishing" do - document_without_pre_publication_edition = create(:document, editions: [build(:published_edition)]) - - PublishingApiDocumentRepublishingWorker - .expects(:perform_async_in_queue) - .with("bulk_republishing", document_without_pre_publication_edition.id, true) - .never - - queue_sequence = sequence("queue") - 2.times do document_with_pre_publication_edition = create(:document, editions: [build(:published_edition), build(:draft_edition)]) @@ -70,5 +61,16 @@ class BulkRepublisherTest < ActiveSupport::TestCase BulkRepublisher.new.republish_all_documents_with_pre_publication_editions end + + test "doesn't queue documents without pre-publication editions for republishing" do + document = create(:document, editions: [build(:published_edition)]) + + PublishingApiDocumentRepublishingWorker + .expects(:perform_async_in_queue) + .with("bulk_republishing", document.id, true) + .never + + BulkRepublisher.new.republish_all_documents_with_pre_publication_editions + end end end