Skip to content

Commit

Permalink
Break down BulkRepublisher test
Browse files Browse the repository at this point in the history
Breaking these assertions into multiple tests makes it a little easier
to parse
  • Loading branch information
yndajas committed May 30, 2024
1 parent 9b8f365 commit 7e1ae28
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/unit/app/services/bulk_republisher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)])

Expand All @@ -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

0 comments on commit 7e1ae28

Please sign in to comment.