diff --git a/app/models/editionable_worldwide_organisation.rb b/app/models/editionable_worldwide_organisation.rb index 0427f18ccce..09b2475cc2e 100644 --- a/app/models/editionable_worldwide_organisation.rb +++ b/app/models/editionable_worldwide_organisation.rb @@ -182,10 +182,6 @@ def skip_world_location_validation? false end - def summary_required? - false - end - def translatable? true end diff --git a/app/models/worldwide_organisation_page.rb b/app/models/worldwide_organisation_page.rb index 5fc20464f1f..d9f27610440 100644 --- a/app/models/worldwide_organisation_page.rb +++ b/app/models/worldwide_organisation_page.rb @@ -6,6 +6,7 @@ class WorldwideOrganisationPage < ApplicationRecord validates :corporate_information_page_type_id, presence: true, exclusion: { in: [CorporateInformationPageType::AboutUs.id], message: "Type cannot be `About us`" } + validates :summary, presence: true validate :unique_worldwide_organisation_and_page_type, on: :create, if: :edition validate :parent_edition_has_locales, if: :edition diff --git a/app/views/admin/worldwide_organisation_page_translations/edit.html.erb b/app/views/admin/worldwide_organisation_page_translations/edit.html.erb index 774c8adeb3c..132920de258 100644 --- a/app/views/admin/worldwide_organisation_page_translations/edit.html.erb +++ b/app/views/admin/worldwide_organisation_page_translations/edit.html.erb @@ -10,7 +10,7 @@ textarea: { label: { heading_size: "l", - text: "Translated summary", + text: "Translated summary (required)", }, name: "page[summary]", id: "page_summary", diff --git a/app/views/admin/worldwide_organisation_pages/_form.html.erb b/app/views/admin/worldwide_organisation_pages/_form.html.erb index 4abe85fe31f..b928fd2b0f8 100644 --- a/app/views/admin/worldwide_organisation_pages/_form.html.erb +++ b/app/views/admin/worldwide_organisation_pages/_form.html.erb @@ -24,7 +24,7 @@ <%= render "govuk_publishing_components/components/character_count", { textarea: { label: { - text: "Summary", + text: "Summary (required)", heading_size: "l", }, name: "worldwide_organisation_page[summary]", diff --git a/test/unit/app/models/editionable_worldwide_organisation_test.rb b/test/unit/app/models/editionable_worldwide_organisation_test.rb index 03bc3c4971a..f3bf8314ab8 100644 --- a/test/unit/app/models/editionable_worldwide_organisation_test.rb +++ b/test/unit/app/models/editionable_worldwide_organisation_test.rb @@ -396,4 +396,10 @@ class EditionableWorldwideOrganisationTest < ActiveSupport::TestCase organisation = build(:editionable_worldwide_organisation) organisation.attachments << build(:file_attachment) end + + %w[body summary title].each do |param| + test "should not be valid without a #{param}" do + assert_not build(:editionable_worldwide_organisation, param.to_sym => nil).valid? + end + end end diff --git a/test/unit/app/models/worldwide_organisation_page_test.rb b/test/unit/app/models/worldwide_organisation_page_test.rb index 5bd3d039c63..0bc485019fe 100644 --- a/test/unit/app/models/worldwide_organisation_page_test.rb +++ b/test/unit/app/models/worldwide_organisation_page_test.rb @@ -32,7 +32,7 @@ class WorldwideOrganisationPageTest < ActiveSupport::TestCase page.destroy! end - %w[body corporate_information_page_type_id].each do |param| + %w[body corporate_information_page_type_id summary].each do |param| test "should not be valid without a #{param}" do assert_not build(:worldwide_organisation_page, param.to_sym => nil).valid? end