Skip to content

Commit

Permalink
Merge pull request #9040 from alphagov/1150-remove-republish-rake-tasks
Browse files Browse the repository at this point in the history
Remove `publishing_api:republish` Rake tasks
  • Loading branch information
yndajas authored May 14, 2024
2 parents 325bc06 + 4f57eca commit e8067b8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 100 deletions.
58 changes: 0 additions & 58 deletions lib/tasks/publishing_api.rake
Original file line number Diff line number Diff line change
Expand Up @@ -46,64 +46,6 @@ namespace :publishing_api do
end
end

namespace :republish do
desc "Republish an organisation to the Publishing API"
task :organisation_by_slug, [:slug] => :environment do |_, args|
Organisation.find_by!(slug: args[:slug]).publish_to_publishing_api
end

desc "Republish a person to the Publishing API"
task :person_by_slug, [:slug] => :environment do |_, args|
Person.find_by!(slug: args[:slug]).publish_to_publishing_api
end

desc "Republish a role to the Publishing API"
task :role_by_slug, [:slug] => :environment do |_, args|
Role.find_by!(slug: args[:slug]).publish_to_publishing_api
end

desc "Republish a document to the Publishing API"
task :document_by_slug, [:slug] => :environment do |_, args|
document = Document.find_by!(slug: args[:slug])
PublishingApiDocumentRepublishingWorker.new.perform(document.id)
end

desc "Republish the past prime ministers index page to Publishing API"
task republish_past_prime_ministers_index: :environment do
PresentPageToPublishingApiWorker.perform_async("PublishingApi::HistoricalAccountsIndexPresenter")
end

desc "Republish the how government works page to Publishing API"
task republish_how_government_works: :environment do
PresentPageToPublishingApiWorker.perform_async("PublishingApi::HowGovernmentWorksPresenter")
end

desc "Republish the fields of operation index page to Publishing API"
task republish_operational_fields_index: :environment do
PresentPageToPublishingApiWorker.perform_async("PublishingApi::OperationalFieldsIndexPresenter")
end

desc "Republish the ministers index page to Publishing API"
task republish_ministers_index: :environment do
PresentPageToPublishingApiWorker.perform_async("PublishingApi::MinistersIndexPresenter")
end

desc "Republish the embassies index page to Publishing API"
task republish_embassies_index: :environment do
PresentPageToPublishingApiWorker.perform_async("PublishingApi::EmbassiesIndexPresenter")
end

desc "Republish the world index page to Publishing API"
task republish_world_index: :environment do
PresentPageToPublishingApiWorker.perform_async("PublishingApi::WorldIndexPresenter")
end

desc "Republish the organisations index page to Publishing API"
task republish_organisations_index: :environment do
PresentPageToPublishingApiWorker.perform_async("PublishingApi::OrganisationsIndexPresenter")
end
end

namespace :patch_links do
desc "Send links for all organisations to Publishing API."
task organisations: :environment do
Expand Down
42 changes: 0 additions & 42 deletions test/unit/lib/tasks/publishing_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,48 +61,6 @@ class PublishingApiRake < ActiveSupport::TestCase
end
end

describe "republish" do
describe "#document_by_slug" do
let(:task) { Rake::Task["publishing_api:republish:document_by_slug"] }

test "republishes document by slug" do
document = create(:document)
PublishingApiDocumentRepublishingWorker.any_instance.expects(:perform).with(document.id)
capture_io { task.invoke(document.slug) }
end
end

describe "#organisation_by_slug" do
let(:task) { Rake::Task["publishing_api:republish:organisation_by_slug"] }

test "Republishes organisation by slug" do
record = create(:organisation)
Organisation.any_instance.expects(:publish_to_publishing_api)
capture_io { task.invoke(record.slug) }
end
end

describe "#person_by_slug" do
let(:task) { Rake::Task["publishing_api:republish:person_by_slug"] }

test "Republishes person by slug" do
record = create(:person)
Person.any_instance.expects(:publish_to_publishing_api)
capture_io { task.invoke(record.slug) }
end
end

describe "#role_by_slug" do
let(:task) { Rake::Task["publishing_api:republish:role_by_slug"] }

test "Republishes role by slug" do
record = create(:role)
Role.any_instance.expects(:publish_to_publishing_api)
capture_io { task.invoke(record.slug) }
end
end
end

describe "patch_links" do
describe "#organisations" do
let(:task) { Rake::Task["publishing_api:patch_links:organisations"] }
Expand Down

0 comments on commit e8067b8

Please sign in to comment.