diff --git a/app/workers/scheduled_publisher.rb b/app/workers/scheduled_publisher.rb index 494a8018a..4bd297384 100644 --- a/app/workers/scheduled_publisher.rb +++ b/app/workers/scheduled_publisher.rb @@ -35,6 +35,7 @@ def perform(edition_id) edition = Edition.find(edition_id) edition.publish_anonymously! + UpdateService.call(edition) PublishService.call(edition) report_state_counts diff --git a/test/unit/scheduled_publisher_test.rb b/test/unit/scheduled_publisher_test.rb index 59e201b9e..4fb1a1ce6 100644 --- a/test/unit/scheduled_publisher_test.rb +++ b/test/unit/scheduled_publisher_test.rb @@ -32,8 +32,12 @@ class ScheduledPublisherTest < ActiveSupport::TestCase assert @edition.reload.published? end - should "call downstream publish service" do - PublishService.expects(:call).with(@edition) + should "update publishing api with latest edition payload before publishing" do + sequence = sequence(:task_order) + + UpdateService.expects(:call).with(@edition).in_sequence(sequence) + PublishService.expects(:call).with(@edition).in_sequence(sequence) + ScheduledPublisher.new.perform(@edition.id.to_s) end