Skip to content

Commit

Permalink
Publish history index
Browse files Browse the repository at this point in the history
This also adds a call to publishing-api which overrides the publishing
app's path reservation for the base_path. The reservation is overwritten and
updated so the publishing app is government-frontend.
  • Loading branch information
1pretz1 committed Jun 2, 2020
1 parent 49f25b6 commit 58ce848
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/publish_static_pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@ module PublishStaticPages
template: "histories/lancaster_house",
base_path: "/government/history/lancaster-house",
},
{
content_id: "db95a864-874f-4f50-a483-352a5bc7ba18",
title: "History of the UK government",
description: "In this section you can read short biographies of notable people and explore the history of government buildings. You can also search our online records and read articles and blog posts by historians.",
template: "histories/history",
base_path: "/government/history",
},
].freeze

def self.publish_all
PAGES.each do |page|
payload = present_for_publishing_api(page)

Services.publishing_api.put_path(page[:base_path], publishing_app: "government-frontend", override_existing: true)
Services.publishing_api.put_content(payload[:content_id], payload[:content])
Services.publishing_api.publish(payload[:content_id], nil, locale: "en")
end
Expand Down
3 changes: 3 additions & 0 deletions test/unit/publish_static_pages_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class PublishStaticPagesTest < ActiveSupport::TestCase

def expect_publishing(pages)
pages.each do |page|
Services.publishing_api.expects(:put_path)
.with(page[:base_path], publishing_app: "government-frontend", override_existing: true)

Services.publishing_api.expects(:put_content)
.with(
page[:content_id],
Expand Down

0 comments on commit 58ce848

Please sign in to comment.