Skip to content

Commit

Permalink
Merge pull request #9079 from alphagov/revert-rake-task-state-argument
Browse files Browse the repository at this point in the history
Revert "Add state argument to `worldwide_corporate_information_page` task"
  • Loading branch information
yndajas authored May 28, 2024
2 parents 49ef76e + 3fae4cc commit 2d36296
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
7 changes: 3 additions & 4 deletions lib/tasks/publishing_api.rake
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,9 @@ namespace :publishing_api do
puts "Finished enqueueing items for Publishing API"
end

desc "Republish all Worldwide CorporateInformationPages"
task :worldwide_corporate_information_pages, [:states] => :environment do |_, args|
states = args[:states]&.split("|") || "published"
worldwide_corporate_information_pages = CorporateInformationPage.joins(:worldwide_organisation).where(state: states)
desc "Republish all published Worldwide CorporateInformationPages"
task worldwide_corporate_information_pages: :environment do
worldwide_corporate_information_pages = CorporateInformationPage.joins(:worldwide_organisation).where(state: "published")
puts "Enqueueing #{worldwide_corporate_information_pages.count} Worldwide CorporateInformationPages"
worldwide_corporate_information_pages.each do |corporate_information_page|
PublishingApiDocumentRepublishingWorker.perform_async_in_queue("bulk_republishing", corporate_information_page.document_id, true)
Expand Down
25 changes: 1 addition & 24 deletions test/unit/lib/tasks/publishing_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class PublishingApiRake < ActiveSupport::TestCase
describe "#worldwide_corporate_information_pages" do
let(:task) { Rake::Task["publishing_api:bulk_republish:worldwide_corporate_information_pages"] }

test "republishes published worldwide corporate information pages (including about pages) by default" do
test "republishes published worldwide corporate information pages (including about pages)" do
create(
:published_worldwide_organisation_corporate_information_page,
corporate_information_page_type_id: CorporateInformationPageType::AboutUs.id,
Expand All @@ -346,29 +346,6 @@ class PublishingApiRake < ActiveSupport::TestCase

capture_io { task.invoke }
end

test "republishes worldwide corporate information pages (including about pages) by state when provided as pipe separated args" do
create(
:published_worldwide_organisation_corporate_information_page,
corporate_information_page_type_id: CorporateInformationPageType::AboutUs.id,
)

create(
:published_worldwide_organisation_corporate_information_page,
corporate_information_page_type_id: CorporateInformationPageType::ComplaintsProcedure.id,
)

create(:corporate_information_page, :draft, worldwide_organisation: create(:worldwide_organisation), organisation: nil)

create(
:published_corporate_information_page,
corporate_information_page_type_id: CorporateInformationPageType::ComplaintsProcedure.id,
)

PublishingApiDocumentRepublishingWorker.expects(:perform_async_in_queue).times(3)

capture_io { task.invoke("published|draft") }
end
end

describe "#by_organisation" do
Expand Down

0 comments on commit 2d36296

Please sign in to comment.