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 86f7201 commit 09ff5ee
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/unit/app/services/bulk_republisher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +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
Expand All @@ -70,5 +63,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 09ff5ee

Please sign in to comment.