From ad59458220d9f57d9a6e9e8375586c23e52185bc Mon Sep 17 00:00:00 2001 From: Harriet H-W Date: Wed, 9 Oct 2024 14:11:28 +0100 Subject: [PATCH 1/4] rename Content Object Store to Content Block Manager this includes routes, engine name, test names etc. --- app/assets/stylesheets/application.scss | 2 +- config/features.rb | 2 +- config/routes.rb | 2 +- ...s.png => content_block_manager_models.png} | Bin ...puml => content_block_manager_models.puml} | 0 .../content_block_manager}/application.scss | 0 .../components/_timeline-component.scss | 0 .../index/summary_card_component.html.erb | 0 .../document/index/summary_card_component.rb | 4 +- .../show/document_timeline_component.html.erb | 0 .../show/document_timeline_component.rb | 2 +- .../host_editions_table_component.html.erb | 0 .../show/host_editions_table_component.rb | 2 +- .../show/summary_list_component.html.erb | 0 .../document/show/summary_list_component.rb | 4 +- .../new/error_summary_component.html.erb | 0 .../new/error_summary_component.rb | 2 +- .../new/select_schema_component.html.erb | 0 .../new/select_schema_component.rb | 2 +- .../confirm_summary_list_component.html.erb | 0 .../show/confirm_summary_list_component.rb | 2 +- .../content_block_manager}/base_controller.rb | 14 ++-- .../content_block/documents_controller.rb | 26 ++++++++ .../editions/workflow_controller.rb | 30 ++++----- .../content_block/editions_controller.rb | 32 ++++++++++ .../content_block/edition_form.rb | 16 ++--- .../lib/content_block_manager}/publishable.rb | 4 +- .../content_block_manager}/content_block.rb | 2 +- .../content_block/document.rb | 6 +- .../content_block/edition.rb | 2 +- .../content_block/edition/documentable.rb | 2 +- .../content_block/edition/has_audit_trail.rb | 2 +- .../content_block/edition/has_authors.rb | 4 +- .../content_block/edition/has_creator.rb | 2 +- .../edition/has_lead_organisation.rb | 6 +- .../edition/validates_details.rb | 6 +- .../content_block/edition/workflow.rb | 4 +- .../content_block/edition_author.rb | 2 +- .../content_block/edition_organisation.rb | 2 +- .../content_block/schema.rb | 2 +- .../content_block/version.rb | 2 +- .../host_content_item.rb | 2 +- .../create_edition_service.rb | 6 +- .../get_host_content_items.rb | 4 +- .../publish_edition_service.rb | 2 +- .../schedule_edition_service.rb | 6 +- .../details_validator.rb | 2 +- .../organisation_validator.rb | 2 +- .../scheduled_publication_validator.rb | 2 +- .../content_block/documents/_schemas.html.erb | 6 +- .../content_block/documents/index.html.erb | 4 +- .../content_block/documents/new.html.erb | 8 +-- .../content_block/documents/show.html.erb | 8 +-- .../content_block/editions/edit.html.erb | 2 +- .../content_block/editions/new.html.erb | 2 +- .../editions/workflow/review.html.erb | 8 +-- .../editions/workflow/review_links.html.erb | 10 +-- .../workflow/schedule_publishing.html.erb | 12 ++-- .../content_block/shared/_form.html.erb | 8 +-- .../app/views/shared/_header.html.erb | 4 +- .../publish_intent_worker.rb | 2 +- .../schedule_publishing_worker.rb | 12 ++-- .../config/application.rb | 4 +- .../config/locales/en.yml | 5 ++ .../config/routes.rb | 4 +- .../features/content_block_manager.feature} | 4 +- .../features/create_object.feature | 2 +- .../features/edit_object.feature | 2 +- .../object_store_feature_flag.feature | 2 +- .../features/schedule_object.feature | 2 +- .../content_block_manager_steps.rb} | 58 ++++++++--------- .../features/support/stubs.rb | 0 .../features/view_object.feature | 2 +- .../lib/content_block_manager.rb | 4 ++ .../lib/content_block_manager}/engine.rb | 2 +- .../index/summary_card_component_test.rb | 10 +-- .../show/document_timeline_component_test.rb | 4 +- .../host_editions_table_component_test.rb | 8 +-- .../show/summary_list_component_test.rb | 6 +- .../new/error_summary_component_test.rb | 4 +- .../new/select_schema_component_test.rb | 4 +- .../confirm_summary_list_component_test.rb | 4 +- .../test/factories/content_block_document.rb | 4 +- .../test/factories/content_block_edition.rb | 4 +- .../content_block_edition_organisation.rb | 6 ++ .../test/factories/content_block_schema.rb | 16 +++++ .../test/factories/content_block_version.rb | 2 +- .../test/factories/host_content_item.rb | 2 +- .../test/functional/base_controller_test.rb | 5 ++ .../content_block/editions_controller_test.rb | 4 +- .../test/integration/base_test.rb | 8 +-- .../content_block/documents_test.rb | 28 ++++---- .../content_block/editions_test.rb | 60 +++++++++--------- .../content_block/workflow_test.rb | 50 +++++++-------- .../test/support/integration_test_helpers.rb | 4 +- .../content_block/edition_form_test.rb | 18 +++--- .../publishable_test.rb | 4 +- .../app/models/content_block_document_test.rb | 4 +- .../has_audit_trail_test.rb | 6 +- .../has_lead_organisation_test.rb | 2 +- .../validates_details_test.rb | 6 +- .../content_block_edition/workflow_test.rb | 2 +- .../app/models/content_block_edition_test.rb | 6 +- .../app/models/content_block_schema_test.rb | 30 ++++----- .../services/create_edition_service_test.rb | 26 ++++---- .../services/get_host_content_items_test.rb | 4 +- .../services/publish_edition_service_test.rb | 18 +++--- .../services/schedule_edition_service_test.rb | 18 +++--- .../app/validators/details_validator_test.rb | 2 +- .../validators/organisation_validator_test.rb | 2 +- .../app/workers/publish_intent_worker_test.rb | 4 +- .../schedule_publishing_worker_test.rb | 56 ++++++++-------- .../content_block/documents_controller.rb | 26 -------- .../content_block/editions_controller.rb | 32 ---------- .../config/locales/en.yml | 5 -- .../lib/content_object_store.rb | 4 -- .../content_block_edition_organisation.rb | 6 -- .../test/factories/content_block_schema.rb | 16 ----- .../test/functional/base_controller_test.rb | 5 -- 119 files changed, 464 insertions(+), 464 deletions(-) rename docs/diagrams/{object_store_models.png => content_block_manager_models.png} (100%) rename docs/diagrams/{object_store_models.puml => content_block_manager_models.puml} (100%) rename lib/engines/{content_object_store/app/assets/stylesheets/content_object_store => content_block_manager/app/assets/stylesheets/content_block_manager}/application.scss (100%) rename lib/engines/{content_object_store/app/assets/stylesheets/content_object_store => content_block_manager/app/assets/stylesheets/content_block_manager}/components/_timeline-component.scss (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/index/summary_card_component.html.erb (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/index/summary_card_component.rb (50%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/show/document_timeline_component.html.erb (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/show/document_timeline_component.rb (88%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/show/host_editions_table_component.html.erb (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/show/host_editions_table_component.rb (93%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/show/summary_list_component.html.erb (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block/document/show/summary_list_component.rb (87%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block_edition/new/error_summary_component.html.erb (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block_edition/new/error_summary_component.rb (54%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block_edition/new/select_schema_component.html.erb (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block_edition/new/select_schema_component.rb (80%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block_edition/show/confirm_summary_list_component.html.erb (100%) rename lib/engines/{content_object_store/app/components/content_object_store => content_block_manager/app/components/content_block_manager}/content_block_edition/show/confirm_summary_list_component.rb (89%) rename lib/engines/{content_object_store/app/controllers/content_object_store => content_block_manager/app/controllers/content_block_manager}/base_controller.rb (73%) create mode 100644 lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/documents_controller.rb rename lib/engines/{content_object_store/app/controllers/content_object_store => content_block_manager/app/controllers/content_block_manager}/content_block/editions/workflow_controller.rb (50%) create mode 100644 lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions_controller.rb rename lib/engines/{content_object_store/app/forms/content_object_store => content_block_manager/app/forms/content_block_manager}/content_block/edition_form.rb (62%) rename lib/engines/{content_object_store/app/lib/content_object_store => content_block_manager/app/lib/content_block_manager}/publishable.rb (96%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block.rb (77%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/document.rb (77%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition.rb (93%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition/documentable.rb (97%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition/has_audit_trail.rb (96%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition/has_authors.rb (73%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition/has_creator.rb (94%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition/has_lead_organisation.rb (76%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition/validates_details.rb (86%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition/workflow.rb (87%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition_author.rb (83%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/edition_organisation.rb (84%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/schema.rb (97%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/content_block/version.rb (90%) rename lib/engines/{content_object_store/app/models/content_object_store => content_block_manager/app/models/content_block_manager}/host_content_item.rb (82%) rename lib/engines/{content_object_store/app/services/content_object_store => content_block_manager/app/services/content_block_manager}/create_edition_service.rb (81%) rename lib/engines/{content_object_store/app/services/content_object_store => content_block_manager/app/services/content_block_manager}/get_host_content_items.rb (92%) rename lib/engines/{content_object_store/app/services/content_object_store => content_block_manager/app/services/content_block_manager}/publish_edition_service.rb (89%) rename lib/engines/{content_object_store/app/services/content_object_store => content_block_manager/app/services/content_block_manager}/schedule_edition_service.rb (82%) rename lib/engines/{content_object_store/app/validators/content_object_store => content_block_manager/app/validators/content_block_manager}/details_validator.rb (94%) rename lib/engines/{content_object_store/app/validators/content_object_store => content_block_manager/app/validators/content_block_manager}/organisation_validator.rb (74%) rename lib/engines/{content_object_store/app/validators/content_object_store => content_block_manager/app/validators/content_block_manager}/scheduled_publication_validator.rb (84%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/documents/_schemas.html.erb (59%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/documents/index.html.erb (69%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/documents/new.html.erb (53%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/documents/show.html.erb (69%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/editions/edit.html.erb (83%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/editions/new.html.erb (84%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/editions/workflow/review.html.erb (61%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/editions/workflow/review_links.html.erb (71%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/editions/workflow/schedule_publishing.html.erb (85%) rename lib/engines/{content_object_store/app/views/content_object_store => content_block_manager/app/views/content_block_manager}/content_block/shared/_form.html.erb (85%) rename lib/engines/{content_object_store => content_block_manager}/app/views/shared/_header.html.erb (72%) rename lib/engines/{content_object_store/app/workers/content_object_store => content_block_manager/app/workers/content_block_manager}/publish_intent_worker.rb (94%) rename lib/engines/{content_object_store/app/workers/content_object_store => content_block_manager/app/workers/content_block_manager}/schedule_publishing_worker.rb (77%) rename lib/engines/{content_object_store => content_block_manager}/config/application.rb (72%) create mode 100644 lib/engines/content_block_manager/config/locales/en.yml rename lib/engines/{content_object_store => content_block_manager}/config/routes.rb (86%) rename lib/engines/{content_object_store/features/content_object_store.feature => content_block_manager/features/content_block_manager.feature} (70%) rename lib/engines/{content_object_store => content_block_manager}/features/create_object.feature (97%) rename lib/engines/{content_object_store => content_block_manager}/features/edit_object.feature (98%) rename lib/engines/{content_object_store => content_block_manager}/features/object_store_feature_flag.feature (79%) rename lib/engines/{content_object_store => content_block_manager}/features/schedule_object.feature (97%) rename lib/engines/{content_object_store/features/step_definitions/content_object_store_steps.rb => content_block_manager/features/step_definitions/content_block_manager_steps.rb} (81%) rename lib/engines/{content_object_store => content_block_manager}/features/support/stubs.rb (100%) rename lib/engines/{content_object_store => content_block_manager}/features/view_object.feature (93%) create mode 100644 lib/engines/content_block_manager/lib/content_block_manager.rb rename lib/engines/{content_object_store/lib/content_object_store => content_block_manager/lib/content_block_manager}/engine.rb (73%) rename lib/engines/{content_object_store => content_block_manager}/test/components/content_block/document/index/summary_card_component_test.rb (81%) rename lib/engines/{content_object_store => content_block_manager}/test/components/content_block/document/show/document_timeline_component_test.rb (85%) rename lib/engines/{content_object_store => content_block_manager}/test/components/content_block/document/show/host_editions_table_component_test.rb (90%) rename lib/engines/{content_object_store => content_block_manager}/test/components/content_block/document/show/summary_list_component_test.rb (86%) rename lib/engines/{content_object_store => content_block_manager}/test/components/content_block/edition/new/error_summary_component_test.rb (74%) rename lib/engines/{content_object_store => content_block_manager}/test/components/content_block/edition/new/select_schema_component_test.rb (85%) rename lib/engines/{content_object_store => content_block_manager}/test/components/content_block/edition/show/confirm_summary_list_component_test.rb (84%) rename lib/engines/{content_object_store => content_block_manager}/test/factories/content_block_document.rb (64%) rename lib/engines/{content_object_store => content_block_manager}/test/factories/content_block_edition.rb (83%) create mode 100644 lib/engines/content_block_manager/test/factories/content_block_edition_organisation.rb create mode 100644 lib/engines/content_block_manager/test/factories/content_block_schema.rb rename lib/engines/{content_object_store => content_block_manager}/test/factories/content_block_version.rb (76%) rename lib/engines/{content_object_store => content_block_manager}/test/factories/host_content_item.rb (81%) create mode 100644 lib/engines/content_block_manager/test/functional/base_controller_test.rb rename lib/engines/{content_object_store => content_block_manager}/test/functional/content_block/editions_controller_test.rb (50%) rename lib/engines/{content_object_store => content_block_manager}/test/integration/base_test.rb (65%) rename lib/engines/{content_object_store => content_block_manager}/test/integration/content_block/documents_test.rb (63%) rename lib/engines/{content_object_store => content_block_manager}/test/integration/content_block/editions_test.rb (66%) rename lib/engines/{content_object_store => content_block_manager}/test/integration/content_block/workflow_test.rb (65%) rename lib/engines/{content_object_store => content_block_manager}/test/support/integration_test_helpers.rb (51%) rename lib/engines/{content_object_store/test/unit/app/forms/content_object_store => content_block_manager/test/unit/app/forms/content_block_manager}/content_block/edition_form_test.rb (70%) rename lib/engines/{content_object_store/test/unit/app/lib/content_object_store => content_block_manager/test/unit/app/lib/content_block_manager}/publishable_test.rb (93%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/models/content_block_document_test.rb (94%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/models/content_block_edition/has_audit_trail_test.rb (91%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/models/content_block_edition/has_lead_organisation_test.rb (88%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/models/content_block_edition/validates_details_test.rb (80%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/models/content_block_edition/workflow_test.rb (95%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/models/content_block_edition_test.rb (93%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/models/content_block_schema_test.rb (72%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/services/create_edition_service_test.rb (72%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/services/get_host_content_items_test.rb (95%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/services/publish_edition_service_test.rb (82%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/services/schedule_edition_service_test.rb (84%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/validators/details_validator_test.rb (95%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/validators/organisation_validator_test.rb (81%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/workers/publish_intent_worker_test.rb (72%) rename lib/engines/{content_object_store => content_block_manager}/test/unit/app/workers/schedule_publishing_worker_test.rb (61%) delete mode 100644 lib/engines/content_object_store/app/controllers/content_object_store/content_block/documents_controller.rb delete mode 100644 lib/engines/content_object_store/app/controllers/content_object_store/content_block/editions_controller.rb delete mode 100644 lib/engines/content_object_store/config/locales/en.yml delete mode 100644 lib/engines/content_object_store/lib/content_object_store.rb delete mode 100644 lib/engines/content_object_store/test/factories/content_block_edition_organisation.rb delete mode 100644 lib/engines/content_object_store/test/factories/content_block_schema.rb delete mode 100644 lib/engines/content_object_store/test/functional/base_controller_test.rb diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 162e6a280a5..93859945366 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -49,7 +49,7 @@ $govuk-page-width: 1140px; @import "./admin/views/whats-new"; @import "./admin/views/worldwide-organisations-choose-main-office"; -@import "../../../lib/engines/content_object_store/app/assets/stylesheets/content_object_store/application"; +@import "../../../lib/engines/content_block_manager/app/assets/stylesheets/content_block_manager/application"; .app-js-only { display: none; diff --git a/config/features.rb b/config/features.rb index b38e92e5cdb..446700b8b99 100644 --- a/config/features.rb +++ b/config/features.rb @@ -22,6 +22,6 @@ # default: true, # description: "Take over the world." feature :govspeak_visual_editor, description: "Enables a visual editor for Govspeak fields", default: false - feature :content_object_store, description: "Enables the object store for sharable content", default: Rails.env.development? || Whitehall.integration_or_staging? + feature :content_block_manager, description: "Enables the object store for sharable content", default: Rails.env.development? || Whitehall.integration_or_staging? feature :override_government, description: "Enables GDS Editors and Admins to override the government associated with a document", default: false end diff --git a/config/routes.rb b/config/routes.rb index 26b72fe7b18..b1ecc1398ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -459,5 +459,5 @@ def redirect(path, options = { prefix: Whitehall.router_prefix }) mount GovukPublishingComponents::Engine, at: "/component-guide" unless Rails.env.production? - mount ContentObjectStore::Engine, at: "government/admin/content-object-store", as: "content_object_store" + mount ContentBlockManager::Engine, at: "government/admin/content-block-manager", as: "content_block_manager" end diff --git a/docs/diagrams/object_store_models.png b/docs/diagrams/content_block_manager_models.png similarity index 100% rename from docs/diagrams/object_store_models.png rename to docs/diagrams/content_block_manager_models.png diff --git a/docs/diagrams/object_store_models.puml b/docs/diagrams/content_block_manager_models.puml similarity index 100% rename from docs/diagrams/object_store_models.puml rename to docs/diagrams/content_block_manager_models.puml diff --git a/lib/engines/content_object_store/app/assets/stylesheets/content_object_store/application.scss b/lib/engines/content_block_manager/app/assets/stylesheets/content_block_manager/application.scss similarity index 100% rename from lib/engines/content_object_store/app/assets/stylesheets/content_object_store/application.scss rename to lib/engines/content_block_manager/app/assets/stylesheets/content_block_manager/application.scss diff --git a/lib/engines/content_object_store/app/assets/stylesheets/content_object_store/components/_timeline-component.scss b/lib/engines/content_block_manager/app/assets/stylesheets/content_block_manager/components/_timeline-component.scss similarity index 100% rename from lib/engines/content_object_store/app/assets/stylesheets/content_object_store/components/_timeline-component.scss rename to lib/engines/content_block_manager/app/assets/stylesheets/content_block_manager/components/_timeline-component.scss diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/index/summary_card_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/index/summary_card_component.html.erb similarity index 100% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/index/summary_card_component.html.erb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/index/summary_card_component.html.erb diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/index/summary_card_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/index/summary_card_component.rb similarity index 50% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/index/summary_card_component.rb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/index/summary_card_component.rb index 29d08c7016c..73e465872b5 100644 --- a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/index/summary_card_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/index/summary_card_component.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ContentBlock::Document::Index::SummaryCardComponent < ContentObjectStore::ContentBlock::Document::Show::SummaryListComponent +class ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponent < ContentBlockManager::ContentBlock::Document::Show::SummaryListComponent private def rows @@ -18,7 +18,7 @@ def summary_card_actions [ { label: "View/edit", - href: helpers.content_object_store.content_object_store_content_block_document_path(content_block_document), + href: helpers.content_block_manager.content_block_manager_content_block_document_path(content_block_document), }, ] end diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/document_timeline_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/document_timeline_component.html.erb similarity index 100% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/document_timeline_component.html.erb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/document_timeline_component.html.erb diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/document_timeline_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/document_timeline_component.rb similarity index 88% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/document_timeline_component.rb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/document_timeline_component.rb index ea27d074c3f..b1a10c5cd9c 100644 --- a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/document_timeline_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/document_timeline_component.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ContentBlock::Document::Show::DocumentTimelineComponent < ViewComponent::Base +class ContentBlockManager::ContentBlock::Document::Show::DocumentTimelineComponent < ViewComponent::Base include ActionView::Helpers::RecordTagHelper def initialize(content_block_versions:) @content_block_versions = content_block_versions diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/host_editions_table_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.html.erb similarity index 100% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/host_editions_table_component.html.erb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.html.erb diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/host_editions_table_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb similarity index 93% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/host_editions_table_component.rb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb index 44f60ed0557..d6854b33410 100644 --- a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/host_editions_table_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ContentObjectStore::ContentBlock::Document::Show::HostEditionsTableComponent < ViewComponent::Base +class ContentBlockManager::ContentBlock::Document::Show::HostEditionsTableComponent < ViewComponent::Base def initialize(caption:, host_content_items:) @caption = caption @host_content_items = host_content_items diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/summary_list_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/summary_list_component.html.erb similarity index 100% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/summary_list_component.html.erb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/summary_list_component.html.erb diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/summary_list_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/summary_list_component.rb similarity index 87% rename from lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/summary_list_component.rb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/summary_list_component.rb index 7e38ecf5a9b..76cd37676e0 100644 --- a/lib/engines/content_object_store/app/components/content_object_store/content_block/document/show/summary_list_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/summary_list_component.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ContentBlock::Document::Show::SummaryListComponent < ViewComponent::Base +class ContentBlockManager::ContentBlock::Document::Show::SummaryListComponent < ViewComponent::Base def initialize(content_block_document:) @content_block_document = content_block_document end @@ -77,7 +77,7 @@ def scheduled_item def edit_action { - href: helpers.content_object_store.new_content_object_store_content_block_document_edition_path(content_block_document), + href: helpers.content_block_manager.new_content_block_manager_content_block_document_edition_path(content_block_document), link_text: "Change", } end diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/error_summary_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/error_summary_component.html.erb similarity index 100% rename from lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/error_summary_component.html.erb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/error_summary_component.html.erb diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/error_summary_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/error_summary_component.rb similarity index 54% rename from lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/error_summary_component.rb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/error_summary_component.rb index b4732af68d5..4ae679d930c 100644 --- a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/error_summary_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/error_summary_component.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ContentBlockEdition::New::ErrorSummaryComponent < ViewComponent::Base +class ContentBlockManager::ContentBlockEdition::New::ErrorSummaryComponent < ViewComponent::Base def initialize(error_message:) @error_message = error_message end diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/select_schema_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/select_schema_component.html.erb similarity index 100% rename from lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/select_schema_component.html.erb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/select_schema_component.html.erb diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/select_schema_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/select_schema_component.rb similarity index 80% rename from lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/select_schema_component.rb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/select_schema_component.rb index 086de4be205..fa22fb5ac04 100644 --- a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/new/select_schema_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/new/select_schema_component.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ContentBlockEdition::New::SelectSchemaComponent < ViewComponent::Base +class ContentBlockManager::ContentBlockEdition::New::SelectSchemaComponent < ViewComponent::Base def initialize(schemas:, heading:, heading_caption:, error_message:) @heading = heading @heading_caption = heading_caption diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/show/confirm_summary_list_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/show/confirm_summary_list_component.html.erb similarity index 100% rename from lib/engines/content_object_store/app/components/content_object_store/content_block_edition/show/confirm_summary_list_component.html.erb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/show/confirm_summary_list_component.html.erb diff --git a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/show/confirm_summary_list_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/show/confirm_summary_list_component.rb similarity index 89% rename from lib/engines/content_object_store/app/components/content_object_store/content_block_edition/show/confirm_summary_list_component.rb rename to lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/show/confirm_summary_list_component.rb index e247cf5d1d4..7b92eb7716b 100644 --- a/lib/engines/content_object_store/app/components/content_object_store/content_block_edition/show/confirm_summary_list_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block_edition/show/confirm_summary_list_component.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ContentBlockEdition::Show::ConfirmSummaryListComponent < ViewComponent::Base +class ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponent < ViewComponent::Base def initialize(content_block_edition:) @content_block_edition = content_block_edition end diff --git a/lib/engines/content_object_store/app/controllers/content_object_store/base_controller.rb b/lib/engines/content_block_manager/app/controllers/content_block_manager/base_controller.rb similarity index 73% rename from lib/engines/content_object_store/app/controllers/content_object_store/base_controller.rb rename to lib/engines/content_block_manager/app/controllers/content_block_manager/base_controller.rb index bd60f414e56..dd7f7121642 100644 --- a/lib/engines/content_object_store/app/controllers/content_object_store/base_controller.rb +++ b/lib/engines/content_block_manager/app/controllers/content_block_manager/base_controller.rb @@ -1,8 +1,8 @@ -class ContentObjectStore::BaseController < Admin::BaseController - before_action :check_object_store_feature_flag, :set_sentry_tags, :prepend_views +class ContentBlockManager::BaseController < Admin::BaseController + before_action :check_block_manager_feature_flag, :set_sentry_tags, :prepend_views - def check_object_store_feature_flag - forbidden! unless Flipflop.content_object_store? + def check_block_manager_feature_flag + forbidden! unless Flipflop.content_block_manager? end def scheduled_publication_params @@ -30,16 +30,16 @@ def edition_params end def set_sentry_tags - Sentry.set_tags(engine: "content_object_store") + Sentry.set_tags(engine: "content_block_manager") end def product_name - "Content Object Store" + "Content Block Manager" end # This ensures we can override views if we need to without altering the Engine's load order, which # may have unintended consequences def prepend_views - prepend_view_path Rails.root.join("lib/engines/content_object_store/app/views") + prepend_view_path Rails.root.join("lib/engines/content_block_manager/app/views") end end diff --git a/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/documents_controller.rb b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/documents_controller.rb new file mode 100644 index 00000000000..2556fc2d54d --- /dev/null +++ b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/documents_controller.rb @@ -0,0 +1,26 @@ +class ContentBlockManager::ContentBlock::DocumentsController < ContentBlockManager::BaseController + def index + @content_block_documents = ContentBlockManager::ContentBlock::Document.live + end + + def show + @content_block_document = ContentBlockManager::ContentBlock::Document.find(params[:id]) + @content_block_versions = @content_block_document.versions + + @host_content_items = ContentBlockManager::GetHostContentItems.by_embedded_document( + content_block_document: @content_block_document, + ) + end + + def new + @schemas = ContentBlockManager::ContentBlock::Schema.all + end + + def new_document_options_redirect + if params[:block_type].present? + redirect_to content_block_manager.new_content_block_manager_content_block_edition_path(block_type: params.require(:block_type)) + else + redirect_to content_block_manager.new_content_block_manager_content_block_document_path, flash: { error: "You must select a block type" } + end + end +end diff --git a/lib/engines/content_object_store/app/controllers/content_object_store/content_block/editions/workflow_controller.rb b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions/workflow_controller.rb similarity index 50% rename from lib/engines/content_object_store/app/controllers/content_object_store/content_block/editions/workflow_controller.rb rename to lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions/workflow_controller.rb index 3d8387d662f..64c215c657f 100644 --- a/lib/engines/content_object_store/app/controllers/content_object_store/content_block/editions/workflow_controller.rb +++ b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions/workflow_controller.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ContentBlock::Editions::WorkflowController < ContentObjectStore::BaseController +class ContentBlockManager::ContentBlock::Editions::WorkflowController < ContentBlockManager::BaseController NEW_BLOCK_STEPS = { review: "review", }.freeze @@ -10,8 +10,8 @@ class ContentObjectStore::ContentBlock::Editions::WorkflowController < ContentOb def show step = params[:step] - @content_block_edition = ContentObjectStore::ContentBlock::Edition.find(params[:id]) - @schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(@content_block_edition.document.block_type) + @content_block_edition = ContentBlockManager::ContentBlock::Edition.find(params[:id]) + @schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(@content_block_edition.document.block_type) case step when UPDATE_BLOCK_STEPS[:review_links] @@ -25,12 +25,12 @@ def show def update step = params[:step] - @content_block_edition = ContentObjectStore::ContentBlock::Edition.find(params[:id]) - @schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(@content_block_edition.document.block_type) + @content_block_edition = ContentBlockManager::ContentBlock::Edition.find(params[:id]) + @schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(@content_block_edition.document.block_type) case step when UPDATE_BLOCK_STEPS[:review_links] - redirect_to content_object_store.content_object_store_content_block_workflow_path(id: @content_block_edition.id, step: :schedule_publishing) + redirect_to content_block_manager.content_block_manager_content_block_workflow_path(id: @content_block_edition.id, step: :schedule_publishing) when UPDATE_BLOCK_STEPS[:schedule_publishing] schedule_or_publish when NEW_BLOCK_STEPS[:review] @@ -41,14 +41,14 @@ def update private def review - @content_block_edition = ContentObjectStore::ContentBlock::Edition.find(params[:id]) + @content_block_edition = ContentBlockManager::ContentBlock::Edition.find(params[:id]) render :review end def review_links @content_block_document = @content_block_edition.document - @host_content_items = ContentObjectStore::GetHostContentItems.by_embedded_document( + @host_content_items = ContentBlockManager::GetHostContentItems.by_embedded_document( content_block_document: @content_block_document, ) @@ -62,28 +62,28 @@ def schedule_publishing end def schedule_or_publish - @content_block_edition = ContentObjectStore::ContentBlock::Edition.find(params[:id]) - @schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(@content_block_edition.document.block_type) + @content_block_edition = ContentBlockManager::ContentBlock::Edition.find(params[:id]) + @schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(@content_block_edition.document.block_type) if params[:schedule_publishing].blank? @content_block_edition.errors.add(:schedule_publishing, "cannot be blank") raise ActiveRecord::RecordInvalid, @content_block_edition elsif params[:schedule_publishing] == "schedule" - ContentObjectStore::ScheduleEditionService.new(@schema).call(@content_block_edition, scheduled_publication_params) + ContentBlockManager::ScheduleEditionService.new(@schema).call(@content_block_edition, scheduled_publication_params) message = "#{@content_block_edition.block_type.humanize} scheduled successfully" else publish and return end - redirect_to content_object_store.content_object_store_content_block_document_path(@content_block_edition.document), + redirect_to content_block_manager.content_block_manager_content_block_document_path(@content_block_edition.document), flash: { notice: message } rescue ActiveRecord::RecordInvalid - render "content_object_store/content_block/editions/workflow/schedule_publishing" + render "content_block_manager/content_block/editions/workflow/schedule_publishing" end def publish - new_edition = ContentObjectStore::PublishEditionService.new(@schema).call(@content_block_edition) - redirect_to content_object_store.content_object_store_content_block_document_path(new_edition.document), + new_edition = ContentBlockManager::PublishEditionService.new(@schema).call(@content_block_edition) + redirect_to content_block_manager.content_block_manager_content_block_document_path(new_edition.document), flash: { notice: "#{new_edition.block_type.humanize} created successfully" } end end diff --git a/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions_controller.rb b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions_controller.rb new file mode 100644 index 00000000000..82357c47eeb --- /dev/null +++ b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions_controller.rb @@ -0,0 +1,32 @@ +class ContentBlockManager::ContentBlock::EditionsController < ContentBlockManager::BaseController + def new + if params[:document_id] + @content_block_document = ContentBlockManager::ContentBlock::Document.find(params[:document_id]) + @schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(@content_block_document.block_type) + content_block_edition = @content_block_document.latest_edition + else + @schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(params[:block_type].underscore) + content_block_edition = ContentBlockManager::ContentBlock::Edition.new + end + @form = ContentBlockManager::ContentBlock::EditionForm.for( + content_block_edition:, + schema: @schema, + ) + end + + def create + @schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(block_type_param) + new_edition = ContentBlockManager::CreateEditionService.new(@schema).call(edition_params, document_id: params[:document_id]) + step = params[:document_id] ? ContentBlockManager::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links] : ContentBlockManager::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review] + redirect_to content_block_manager.content_block_manager_content_block_workflow_path(id: new_edition.id, step:) + rescue ActiveRecord::RecordInvalid => e + @form = ContentBlockManager::ContentBlock::EditionForm.for(content_block_edition: e.record, schema: @schema) + render "content_block_manager/content_block/editions/new" + end + +private + + def block_type_param + params.require("content_block/edition").require("document_attributes").require(:block_type) + end +end diff --git a/lib/engines/content_object_store/app/forms/content_object_store/content_block/edition_form.rb b/lib/engines/content_block_manager/app/forms/content_block_manager/content_block/edition_form.rb similarity index 62% rename from lib/engines/content_object_store/app/forms/content_object_store/content_block/edition_form.rb rename to lib/engines/content_block_manager/app/forms/content_block_manager/content_block/edition_form.rb index 49eaaeb0dfe..61d74d14ee5 100644 --- a/lib/engines/content_object_store/app/forms/content_object_store/content_block/edition_form.rb +++ b/lib/engines/content_block_manager/app/forms/content_block_manager/content_block/edition_form.rb @@ -1,8 +1,8 @@ # A form object to reuse the same form partial for creating and editing a content block edition # - Creating an object requires dynamic attributes from a schema # # - Editing an object requires attributes from the object itself -class ContentObjectStore::ContentBlock::EditionForm - include ContentObjectStore::Engine.routes.url_helpers +class ContentBlockManager::ContentBlock::EditionForm + include ContentBlockManager::Engine.routes.url_helpers attr_reader :content_block_edition, :schema @@ -22,31 +22,31 @@ def attributes end end - class Create < ContentObjectStore::ContentBlock::EditionForm + class Create < ContentBlockManager::ContentBlock::EditionForm def title "Create a new #{schema.name}" end def url - content_object_store_content_block_editions_path + content_block_manager_content_block_editions_path end def back_path - new_content_object_store_content_block_document_path + new_content_block_manager_content_block_document_path end end - class Update < ContentObjectStore::ContentBlock::EditionForm + class Update < ContentBlockManager::ContentBlock::EditionForm def title "Change #{schema.name}" end def url - content_object_store_content_block_document_editions_path(document_id: @content_block_edition.document.id) + content_block_manager_content_block_document_editions_path(document_id: @content_block_edition.document.id) end def back_path - content_object_store_content_block_document_path(@content_block_edition.document) + content_block_manager_content_block_document_path(@content_block_edition.document) end end end diff --git a/lib/engines/content_object_store/app/lib/content_object_store/publishable.rb b/lib/engines/content_block_manager/app/lib/content_block_manager/publishable.rb similarity index 96% rename from lib/engines/content_object_store/app/lib/content_object_store/publishable.rb rename to lib/engines/content_block_manager/app/lib/content_block_manager/publishable.rb index b1332fcb764..8a0f4bb1d32 100644 --- a/lib/engines/content_object_store/app/lib/content_object_store/publishable.rb +++ b/lib/engines/content_block_manager/app/lib/content_block_manager/publishable.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module Publishable class PublishingFailureError < StandardError; end @@ -37,7 +37,7 @@ def schedule_with_rollback content_block_edition = yield content_block_edition.schedule! - ContentObjectStore::SchedulePublishingWorker.queue(content_block_edition) + ContentBlockManager::SchedulePublishingWorker.queue(content_block_edition) end end diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block.rb similarity index 77% rename from lib/engines/content_object_store/app/models/content_object_store/content_block.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block.rb index db0769c30e3..e60a3988877 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock def self.table_name_prefix "content_block_" diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/document.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/document.rb similarity index 77% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/document.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/document.rb index 1e40be61b03..42601650c60 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/document.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/document.rb @@ -1,18 +1,18 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock class Document < ApplicationRecord has_many :editions, -> { order(created_at: :asc, id: :asc) }, inverse_of: :document - enum :block_type, ContentObjectStore::ContentBlock::Schema.valid_schemas.index_with(&:to_s) + enum :block_type, ContentBlockManager::ContentBlock::Schema.valid_schemas.index_with(&:to_s) attr_readonly :block_type validates :block_type, :title, presence: true has_one :latest_edition, -> { joins(:document).where("content_block_documents.latest_edition_id = content_block_editions.id") }, - class_name: "ContentObjectStore::ContentBlock::Edition", + class_name: "ContentBlockManager::ContentBlock::Edition", inverse_of: :document has_many :versions, through: :editions, source: :versions diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition.rb similarity index 93% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition.rb index 95cb6423ecc..11840ae093a 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock class Edition < ApplicationRecord include Documentable diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/documentable.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/documentable.rb similarity index 97% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition/documentable.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/documentable.rb index a8d5fdf21ab..c00bae08265 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/documentable.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/documentable.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock::Edition::Documentable extend ActiveSupport::Concern diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_audit_trail.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_audit_trail.rb similarity index 96% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_audit_trail.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_audit_trail.rb index 8d82fafa677..e2d7a5e4325 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_audit_trail.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_audit_trail.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock::Edition::HasAuditTrail extend ActiveSupport::Concern diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_authors.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_authors.rb similarity index 73% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_authors.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_authors.rb index d3b40eb2d3b..fda1835f456 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_authors.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_authors.rb @@ -1,10 +1,10 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock::Edition::HasAuthors extend ActiveSupport::Concern include ContentBlock::Edition::HasCreator included do - has_many :edition_authors, dependent: :destroy, class_name: "ContentObjectStore::ContentBlock::EditionAuthor" + has_many :edition_authors, dependent: :destroy, class_name: "ContentBlockManager::ContentBlock::EditionAuthor" end end end diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_creator.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_creator.rb similarity index 94% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_creator.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_creator.rb index 92e77e54a50..248b3de17d4 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_creator.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_creator.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock::Edition::HasCreator extend ActiveSupport::Concern diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_lead_organisation.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_lead_organisation.rb similarity index 76% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_lead_organisation.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_lead_organisation.rb index b18c61eefed..18fc3313deb 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/has_lead_organisation.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/has_lead_organisation.rb @@ -1,14 +1,14 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock::Edition::HasLeadOrganisation extend ActiveSupport::Concern included do has_one :edition_organisation, foreign_key: :content_block_edition_id, dependent: :destroy, - class_name: "ContentObjectStore::ContentBlock::EditionOrganisation" + class_name: "ContentBlockManager::ContentBlock::EditionOrganisation" has_one :organisation, through: :edition_organisation - validates_with ContentObjectStore::OrganisationValidator + validates_with ContentBlockManager::OrganisationValidator end def organisation_id=(organisation_id) diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/validates_details.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/validates_details.rb similarity index 86% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition/validates_details.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/validates_details.rb index db0bac912b9..8a23d271e7e 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/validates_details.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/validates_details.rb @@ -1,11 +1,11 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock::Edition::ValidatesDetails extend ActiveSupport::Concern DETAILS_PREFIX = "details_".freeze included do - validates_with ContentObjectStore::DetailsValidator + validates_with ContentBlockManager::DetailsValidator # Only used in tests, so we can easily add a schema to an edition, without # having to resort to mocks, which are difficult to setup/clean between tests @@ -22,7 +22,7 @@ def self.human_attribute_name(attr, options = {}) end def schema - @schema ||= ContentObjectStore::ContentBlock::Schema.find_by_block_type(block_type) + @schema ||= ContentBlockManager::ContentBlock::Schema.find_by_block_type(block_type) end # When an error is raised about a field within the details hash diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/workflow.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/workflow.rb similarity index 87% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition/workflow.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/workflow.rb index 8e62e56b002..ef88a506dd8 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition/workflow.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition/workflow.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock::Edition::Workflow extend ActiveSupport::Concern include DateValidation @@ -14,7 +14,7 @@ def valid_state?(state) date_attributes :scheduled_publication - validates_with ContentObjectStore::ScheduledPublicationValidator + validates_with ContentBlockManager::ScheduledPublicationValidator state_machine auto_scopes: true do state :draft diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition_author.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition_author.rb similarity index 83% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition_author.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition_author.rb index 6130436f1fd..46725a95e6d 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition_author.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition_author.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock class EditionAuthor < ApplicationRecord belongs_to :edition diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition_organisation.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition_organisation.rb similarity index 84% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/edition_organisation.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition_organisation.rb index 65bff4dc5ff..afdf8a0fdfa 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/edition_organisation.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/edition_organisation.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock class EditionOrganisation < ApplicationRecord belongs_to :edition diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/schema.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/schema.rb similarity index 97% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/schema.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/schema.rb index d412ee62b7f..8be82af799c 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/schema.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/schema.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock class Schema SCHEMA_PREFIX = "content_block".freeze diff --git a/lib/engines/content_object_store/app/models/content_object_store/content_block/version.rb b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/version.rb similarity index 90% rename from lib/engines/content_object_store/app/models/content_object_store/content_block/version.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/content_block/version.rb index 550f11e3992..8a4c22e3746 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/content_block/version.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/content_block/version.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager module ContentBlock class Version < ApplicationRecord enum event: %i[created updated] diff --git a/lib/engines/content_object_store/app/models/content_object_store/host_content_item.rb b/lib/engines/content_block_manager/app/models/content_block_manager/host_content_item.rb similarity index 82% rename from lib/engines/content_object_store/app/models/content_object_store/host_content_item.rb rename to lib/engines/content_block_manager/app/models/content_block_manager/host_content_item.rb index 86d27337e62..621ae8f2706 100644 --- a/lib/engines/content_object_store/app/models/content_object_store/host_content_item.rb +++ b/lib/engines/content_block_manager/app/models/content_block_manager/host_content_item.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager class HostContentItem < Data.define(:title, :base_path, :document_type, :publishing_organisation, :publishing_app) end end diff --git a/lib/engines/content_object_store/app/services/content_object_store/create_edition_service.rb b/lib/engines/content_block_manager/app/services/content_block_manager/create_edition_service.rb similarity index 81% rename from lib/engines/content_object_store/app/services/content_object_store/create_edition_service.rb rename to lib/engines/content_block_manager/app/services/content_block_manager/create_edition_service.rb index 48c31457a64..44096ce8b91 100644 --- a/lib/engines/content_object_store/app/services/content_object_store/create_edition_service.rb +++ b/lib/engines/content_block_manager/app/services/content_block_manager/create_edition_service.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager class CreateEditionService include Publishable @@ -20,9 +20,9 @@ def call(edition_params, document_id: nil) def build_edition(edition_params, document_id) if document_id.nil? - ContentObjectStore::ContentBlock::Edition.new(edition_params) + ContentBlockManager::ContentBlock::Edition.new(edition_params) else - ContentObjectStore::ContentBlock::Edition.new( + ContentBlockManager::ContentBlock::Edition.new( document_id:, document_attributes: edition_params.delete(:document_attributes).except(:block_type).merge({ id: document_id }), ) diff --git a/lib/engines/content_object_store/app/services/content_object_store/get_host_content_items.rb b/lib/engines/content_block_manager/app/services/content_block_manager/get_host_content_items.rb similarity index 92% rename from lib/engines/content_object_store/app/services/content_object_store/get_host_content_items.rb rename to lib/engines/content_block_manager/app/services/content_block_manager/get_host_content_items.rb index 1d037e796b7..2b3191a778b 100644 --- a/lib/engines/content_object_store/app/services/content_object_store/get_host_content_items.rb +++ b/lib/engines/content_block_manager/app/services/content_block_manager/get_host_content_items.rb @@ -2,7 +2,7 @@ require "json" require "uri" -module ContentObjectStore +module ContentBlockManager class GetHostContentItems attr_reader :content_id @@ -16,7 +16,7 @@ def self.by_embedded_document(content_block_document:) def items content_items["results"].map do |item| - ContentObjectStore::HostContentItem.new( + ContentBlockManager::HostContentItem.new( title: item["title"], base_path: item["base_path"], document_type: item["document_type"], diff --git a/lib/engines/content_object_store/app/services/content_object_store/publish_edition_service.rb b/lib/engines/content_block_manager/app/services/content_block_manager/publish_edition_service.rb similarity index 89% rename from lib/engines/content_object_store/app/services/content_object_store/publish_edition_service.rb rename to lib/engines/content_block_manager/app/services/content_block_manager/publish_edition_service.rb index 7839140e873..b546e2670e1 100644 --- a/lib/engines/content_object_store/app/services/content_object_store/publish_edition_service.rb +++ b/lib/engines/content_block_manager/app/services/content_block_manager/publish_edition_service.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager class PublishEditionService include Publishable diff --git a/lib/engines/content_object_store/app/services/content_object_store/schedule_edition_service.rb b/lib/engines/content_block_manager/app/services/content_block_manager/schedule_edition_service.rb similarity index 82% rename from lib/engines/content_object_store/app/services/content_object_store/schedule_edition_service.rb rename to lib/engines/content_block_manager/app/services/content_block_manager/schedule_edition_service.rb index 382031c2aa9..2e9997f6ec9 100644 --- a/lib/engines/content_object_store/app/services/content_object_store/schedule_edition_service.rb +++ b/lib/engines/content_block_manager/app/services/content_block_manager/schedule_edition_service.rb @@ -1,4 +1,4 @@ -module ContentObjectStore +module ContentBlockManager class ScheduleEditionService include Publishable @@ -19,11 +19,11 @@ def call(edition, scheduled_publication_params) private def send_publish_intents_for_host_documents(content_block_edition:) - host_content_items = ContentObjectStore::GetHostContentItems.by_embedded_document( + host_content_items = ContentBlockManager::GetHostContentItems.by_embedded_document( content_block_document: content_block_edition.document, ) host_content_items.each do |host_content_item| - ContentObjectStore::PublishIntentWorker.perform_async( + ContentBlockManager::PublishIntentWorker.perform_async( host_content_item.base_path, host_content_item.publishing_app, content_block_edition.scheduled_publication.to_s, diff --git a/lib/engines/content_object_store/app/validators/content_object_store/details_validator.rb b/lib/engines/content_block_manager/app/validators/content_block_manager/details_validator.rb similarity index 94% rename from lib/engines/content_object_store/app/validators/content_object_store/details_validator.rb rename to lib/engines/content_block_manager/app/validators/content_block_manager/details_validator.rb index e59ff153719..43095358415 100644 --- a/lib/engines/content_object_store/app/validators/content_object_store/details_validator.rb +++ b/lib/engines/content_block_manager/app/validators/content_block_manager/details_validator.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::DetailsValidator < ActiveModel::Validator +class ContentBlockManager::DetailsValidator < ActiveModel::Validator attr_reader :edition def validate(edition) diff --git a/lib/engines/content_object_store/app/validators/content_object_store/organisation_validator.rb b/lib/engines/content_block_manager/app/validators/content_block_manager/organisation_validator.rb similarity index 74% rename from lib/engines/content_object_store/app/validators/content_object_store/organisation_validator.rb rename to lib/engines/content_block_manager/app/validators/content_block_manager/organisation_validator.rb index 08936e2ada6..abba95f21eb 100644 --- a/lib/engines/content_object_store/app/validators/content_object_store/organisation_validator.rb +++ b/lib/engines/content_block_manager/app/validators/content_block_manager/organisation_validator.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::OrganisationValidator < ActiveModel::Validator +class ContentBlockManager::OrganisationValidator < ActiveModel::Validator attr_reader :edition def validate(edition) diff --git a/lib/engines/content_object_store/app/validators/content_object_store/scheduled_publication_validator.rb b/lib/engines/content_block_manager/app/validators/content_block_manager/scheduled_publication_validator.rb similarity index 84% rename from lib/engines/content_object_store/app/validators/content_object_store/scheduled_publication_validator.rb rename to lib/engines/content_block_manager/app/validators/content_block_manager/scheduled_publication_validator.rb index 9a6a095d3e8..2dcc4b243fc 100644 --- a/lib/engines/content_object_store/app/validators/content_object_store/scheduled_publication_validator.rb +++ b/lib/engines/content_block_manager/app/validators/content_block_manager/scheduled_publication_validator.rb @@ -1,4 +1,4 @@ -class ContentObjectStore::ScheduledPublicationValidator < ActiveModel::Validator +class ContentBlockManager::ScheduledPublicationValidator < ActiveModel::Validator attr_reader :edition def validate(edition) diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/_schemas.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/_schemas.html.erb similarity index 59% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/documents/_schemas.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/_schemas.html.erb index 78319eba864..54a894155e0 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/_schemas.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/_schemas.html.erb @@ -1,13 +1,13 @@ <% if flash[:error] %> - <%= render ContentObjectStore::ContentBlockEdition::New::ErrorSummaryComponent.new( + <%= render ContentBlockManager::ContentBlockEdition::New::ErrorSummaryComponent.new( error_message: flash[:error], ) %> <% end %> -<%= form_with url: content_object_store.new_document_options_redirect_content_object_store_content_block_documents_path, method: :post do %> +<%= form_with url: content_block_manager.new_document_options_redirect_content_block_manager_content_block_documents_path, method: :post do %> <%= hidden_field_tag :block_type, "" %> - <%= render ContentObjectStore::ContentBlockEdition::New::SelectSchemaComponent.new( + <%= render ContentBlockManager::ContentBlockEdition::New::SelectSchemaComponent.new( heading: content_for(:page_title), heading_caption: content_for(:context), error_message: flash[:error], diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/index.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/index.html.erb similarity index 69% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/documents/index.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/index.html.erb index 3efc9514fe1..d9bf6ae6485 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/index.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/index.html.erb @@ -5,7 +5,7 @@
<%= render "govuk_publishing_components/components/button", { text: "Create new object", - href: content_object_store.new_content_object_store_content_block_document_path, + href: content_block_manager.new_content_block_manager_content_block_document_path, } %>
@@ -13,7 +13,7 @@
<% @content_block_documents.each do |content_block_document| %> - <%= render ContentObjectStore::ContentBlock::Document::Index::SummaryCardComponent.new(content_block_document:) %> + <%= render ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponent.new(content_block_document:) %> <% end %>
diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/new.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/new.html.erb similarity index 53% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/documents/new.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/new.html.erb index 2a94a08d010..3271abaa39d 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/new.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/new.html.erb @@ -3,17 +3,17 @@ <% if @schemas %> <% content_for :back_link do %> <%= render "govuk_publishing_components/components/back_link", { - href: content_object_store.content_object_store_content_block_documents_path, + href: content_block_manager.content_block_manager_content_block_documents_path, } %> <% end %> <% content_for :page_title, "Select a block type" %> - <%= render partial: "content_object_store/content_block/documents/schemas", locals: { schemas: @schemas} %> + <%= render partial: "content_block_manager/content_block/documents/schemas", locals: { schemas: @schemas} %> <% else %> <% content_for :back_link do %> <%= render "govuk_publishing_components/components/back_link", { - href: content_object_store.new_content_object_store_content_block_document_path, + href: content_block_manager.new_content_block_manager_content_block_document_path, } %> <% end %> <% content_for :title, "Create #{@schema.name}" %> - <%= render partial: "content_object_store/content_block/shared/form", locals: { form: @form } %> + <%= render partial: "content_block_manager/content_block/shared/form", locals: { form: @form } %> <% end %> diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/show.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/show.html.erb similarity index 69% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/documents/show.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/show.html.erb index bd5e87f4afa..9610dcdc055 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/documents/show.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/documents/show.html.erb @@ -2,12 +2,12 @@ <% content_for :title, "Manage #{add_indefinite_article @content_block_document.block_type.humanize}" %> <% content_for :back_link do %> <%= render "govuk_publishing_components/components/back_link", { - href: content_object_store.content_object_store_content_block_documents_path, + href: content_block_manager.content_block_manager_content_block_documents_path, } %> <% end %> <%= render( - ContentObjectStore::ContentBlock::Document::Show::SummaryListComponent.new( + ContentBlockManager::ContentBlock::Document::Show::SummaryListComponent.new( content_block_document: @content_block_document, ), ) %> @@ -15,7 +15,7 @@
<%= render( - ContentObjectStore::ContentBlock::Document::Show::HostEditionsTableComponent.new( + ContentBlockManager::ContentBlock::Document::Show::HostEditionsTableComponent.new( caption: "Content appears in", host_content_items: @host_content_items, ), @@ -26,7 +26,7 @@
<%= render( - ContentObjectStore::ContentBlock::Document::Show::DocumentTimelineComponent.new( + ContentBlockManager::ContentBlock::Document::Show::DocumentTimelineComponent.new( content_block_versions: @content_block_versions, ), ) %> diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/edit.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/edit.html.erb similarity index 83% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/editions/edit.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/edit.html.erb index dc27c5b7f72..c9a4a1d3ec8 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/edit.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/edit.html.erb @@ -13,4 +13,4 @@ } %> <% end %> -<%= render partial: "content_object_store/content_block/shared/form", locals: { form: @form } %> +<%= render partial: "content_block_manager/content_block/shared/form", locals: { form: @form } %> diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/new.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/new.html.erb similarity index 84% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/editions/new.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/new.html.erb index adcd403dace..b1baff2f1da 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/new.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/new.html.erb @@ -13,4 +13,4 @@ } %> <% end %> -<%= render partial: "content_object_store/content_block/shared/form", locals: { form: @form } %> +<%= render partial: "content_block_manager/content_block/shared/form", locals: { form: @form } %> diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/review.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review.html.erb similarity index 61% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/review.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review.html.erb index 5606eca476d..5137a81a77e 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/review.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review.html.erb @@ -2,14 +2,14 @@ <% content_for :title, "Check your answers" %> <% content_for :back_link do %> <%= render "govuk_publishing_components/components/back_link", { - href: content_object_store.content_object_store_content_block_documents_path, + href: content_block_manager.content_block_manager_content_block_documents_path, } %> <% end %>
<%= render( - ContentObjectStore::ContentBlockEdition::Show::ConfirmSummaryListComponent.new( + ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponent.new( content_block_edition: @content_block_edition, ), ) %> @@ -18,7 +18,7 @@
- <%= form_with(url: content_object_store.content_object_store_content_block_workflow_path(@content_block_edition, step: ContentObjectStore::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review]), method: :put) do %> + <%= form_with(url: content_block_manager.content_block_manager_content_block_workflow_path(@content_block_edition, step: ContentBlockManager::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review]), method: :put) do %>
<%= render "govuk_publishing_components/components/button", { text: "Accept and publish", @@ -26,7 +26,7 @@ value: "Accept and publish", type: "submit", } %> - <%= link_to("Cancel", content_object_store.content_object_store_content_block_documents_path, class: "govuk-link") %> + <%= link_to("Cancel", content_block_manager.content_block_manager_content_block_documents_path, class: "govuk-link") %>
<% end %>
diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/review_links.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb similarity index 71% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/review_links.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb index 19eecedda53..f124f54fde5 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/review_links.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb @@ -3,7 +3,7 @@ <% content_for :title_margin_bottom, 4 %> <% content_for :back_link do %> <%= render "govuk_publishing_components/components/back_link", { - href: content_object_store.new_content_object_store_content_block_edition_path(@content_block_document.id), + href: content_block_manager.new_content_block_manager_content_block_edition_path(@content_block_document.id), } %> <% end %> @@ -12,7 +12,7 @@
<%= render( - ContentObjectStore::ContentBlock::Document::Show::HostEditionsTableComponent.new( + ContentBlockManager::ContentBlock::Document::Show::HostEditionsTableComponent.new( caption: "Content it appears in", host_content_items: @host_content_items, ), @@ -25,9 +25,9 @@
<%= form_with( - url: content_object_store.content_object_store_content_block_workflow_path( + url: content_block_manager.content_block_manager_content_block_workflow_path( edition_id: @content_block_edition.id, - step: ContentObjectStore::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links], + step: ContentBlockManager::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links], ), method: :put, ) do %> @@ -38,7 +38,7 @@ value: "Save and continue", type: "submit", } %> - <%= link_to("Cancel", content_object_store.content_object_store_content_block_documents_path, class: "govuk-link") %> + <%= link_to("Cancel", content_block_manager.content_block_manager_content_block_documents_path, class: "govuk-link") %>
<% end %>
diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/schedule_publishing.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/schedule_publishing.html.erb similarity index 85% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/schedule_publishing.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/schedule_publishing.html.erb index d6f556003b6..7c6e678d81f 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/editions/workflow/schedule_publishing.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/schedule_publishing.html.erb @@ -3,9 +3,9 @@ <% content_for :title_margin_bottom, 4 %> <% content_for :back_link do %> <%= render "govuk_publishing_components/components/back_link", { - href: content_object_store.content_object_store_content_block_workflow_path( + href: content_block_manager.content_block_manager_content_block_workflow_path( edition_id: @content_block_edition.id, - step: ContentObjectStore::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links], + step: ContentBlockManager::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links], ), } %> <% end %> @@ -25,9 +25,9 @@
- <%= form_with url: content_object_store.content_object_store_content_block_workflow_path( + <%= form_with url: content_block_manager.content_block_manager_content_block_workflow_path( edition_id: @content_block_edition.id, - step: ContentObjectStore::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:schedule_publishing], + step: ContentBlockManager::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:schedule_publishing], ), method: :put do %> @@ -70,7 +70,7 @@ }, day: { value: day_param.blank? ? nil : day_param.to_i, - id: "content_object_store/content_block/edition_scheduled_publication", + id: "content_block_manager/content_block/edition_scheduled_publication", name: "scheduled_at[scheduled_publication(3i)]", label: "Day", width: 2, @@ -96,7 +96,7 @@ value: "Accept and publish", type: "submit", } %> - <%= link_to("Cancel", content_object_store.content_object_store_content_block_documents_path, class: "govuk-link") %> + <%= link_to("Cancel", content_block_manager.content_block_manager_content_block_documents_path, class: "govuk-link") %>
<% end %> diff --git a/lib/engines/content_object_store/app/views/content_object_store/content_block/shared/_form.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/shared/_form.html.erb similarity index 85% rename from lib/engines/content_object_store/app/views/content_object_store/content_block/shared/_form.html.erb rename to lib/engines/content_block_manager/app/views/content_block_manager/content_block/shared/_form.html.erb index b625273bedc..c458f39916c 100644 --- a/lib/engines/content_object_store/app/views/content_object_store/content_block/shared/_form.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/shared/_form.html.erb @@ -3,17 +3,17 @@ <%= form_with( url: @form.url, method: :post, - model: [content_object_store, @form.content_block_edition]) do |f| %> + model: [content_block_manager, @form.content_block_edition]) do |f| %> <%= hidden_field_tag "content_block/edition[document_attributes][block_type]", @form.schema.block_type, - id: "content_object_store/content_block_edition_document_block_type" %> + id: "content_block_manager/content_block_edition_document_block_type" %> <%= render "govuk_publishing_components/components/input", { label: { text: "Title", }, name: "content_block/edition[document_attributes][title]", - id: "content_object_store/content_block/edition_document_title", + id: "content_block_manager/content_block/edition_document_title", value: @form.content_block_edition.document&.title, error_items: errors_for(@form.content_block_edition.errors, "document.title".to_sym), } %> @@ -24,7 +24,7 @@ text: field.humanize, }, name: "content_block/edition[details[#{field}]]", - id: "content_object_store/content_block/edition_details_#{field}", + id: "content_block_manager/content_block/edition_details_#{field}", value: @form.content_block_edition.details&.fetch(field, nil), error_items: errors_for(@form.content_block_edition.errors, "details_#{field}".to_sym), } %> diff --git a/lib/engines/content_object_store/app/views/shared/_header.html.erb b/lib/engines/content_block_manager/app/views/shared/_header.html.erb similarity index 72% rename from lib/engines/content_object_store/app/views/shared/_header.html.erb rename to lib/engines/content_block_manager/app/views/shared/_header.html.erb index 1720483f406..5c16a372cc2 100644 --- a/lib/engines/content_object_store/app/views/shared/_header.html.erb +++ b/lib/engines/content_block_manager/app/views/shared/_header.html.erb @@ -3,9 +3,9 @@ <%= render "govuk_publishing_components/components/layout_header", { product_name:, environment: environment, - logo_link: content_object_store.content_object_store_root_path, + logo_link: content_block_manager.content_block_manager_root_path, navigation_items: [ - main_nav_item("Dashboard", content_object_store.content_object_store_root_path), + main_nav_item("Dashboard", content_block_manager.content_block_manager_root_path), { text: "View website", href: Whitehall.public_root, diff --git a/lib/engines/content_object_store/app/workers/content_object_store/publish_intent_worker.rb b/lib/engines/content_block_manager/app/workers/content_block_manager/publish_intent_worker.rb similarity index 94% rename from lib/engines/content_object_store/app/workers/content_object_store/publish_intent_worker.rb rename to lib/engines/content_block_manager/app/workers/content_block_manager/publish_intent_worker.rb index 840027d5257..d914f4200cb 100644 --- a/lib/engines/content_object_store/app/workers/content_object_store/publish_intent_worker.rb +++ b/lib/engines/content_block_manager/app/workers/content_block_manager/publish_intent_worker.rb @@ -1,6 +1,6 @@ require "sidekiq/api" -module ContentObjectStore +module ContentBlockManager class PublishIntentWorker < WorkerBase sidekiq_options queue: :content_block_publishing diff --git a/lib/engines/content_object_store/app/workers/content_object_store/schedule_publishing_worker.rb b/lib/engines/content_block_manager/app/workers/content_block_manager/schedule_publishing_worker.rb similarity index 77% rename from lib/engines/content_object_store/app/workers/content_object_store/schedule_publishing_worker.rb rename to lib/engines/content_block_manager/app/workers/content_block_manager/schedule_publishing_worker.rb index 83928714a86..5dc90d3b907 100644 --- a/lib/engines/content_object_store/app/workers/content_object_store/schedule_publishing_worker.rb +++ b/lib/engines/content_block_manager/app/workers/content_block_manager/schedule_publishing_worker.rb @@ -3,7 +3,7 @@ # ContentBlockPublishingWorker is a job that is scheduled by the `ScheduleEditionService`. # It is never executed immediately but uses the Sidekiq delay mechanism to # execute at the time the edition should be published. -module ContentObjectStore +module ContentBlockManager class SchedulePublishingWorker < WorkerBase SchedulingFailure = Class.new(StandardError) @@ -43,17 +43,17 @@ def queued_jobs def perform(edition_id) logger.info("performing content block publishing job for Edition #{edition_id}") - edition = ContentObjectStore::ContentBlock::Edition.find(edition_id) + edition = ContentBlockManager::ContentBlock::Edition.find(edition_id) return if edition.published? || !edition.scheduled? - schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(edition.document.block_type) + schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(edition.document.block_type) - ContentObjectStore::ContentBlock::Edition::HasAuditTrail.acting_as(publishing_robot) do - ContentObjectStore::PublishEditionService.new( + ContentBlockManager::ContentBlock::Edition::HasAuditTrail.acting_as(publishing_robot) do + ContentBlockManager::PublishEditionService.new( schema, ).call(edition) end - rescue ContentObjectStore::Publishable::PublishingFailureError => e + rescue ContentBlockManager::Publishable::PublishingFailureError => e raise SchedulingFailure, e.message end diff --git a/lib/engines/content_object_store/config/application.rb b/lib/engines/content_block_manager/config/application.rb similarity index 72% rename from lib/engines/content_object_store/config/application.rb rename to lib/engines/content_block_manager/config/application.rb index e37e6407458..bed951cfa78 100644 --- a/lib/engines/content_object_store/config/application.rb +++ b/lib/engines/content_block_manager/config/application.rb @@ -1,8 +1,8 @@ -module ContentObjectStore +module ContentBlockManager class Engine < ::Rails::Engine config.autoload_paths << Dir[File.join(root, "app", "forms", "**", "*.{rb}")] - initializer "content_object_store.load_locale" do |app| + initializer "content_block_manager.load_locale" do |app| app.config.i18n.load_path += Dir[File.join(root, "config", "locales", "**", "*.{rb,yml}")] end end diff --git a/lib/engines/content_block_manager/config/locales/en.yml b/lib/engines/content_block_manager/config/locales/en.yml new file mode 100644 index 00000000000..d71e3d5eae5 --- /dev/null +++ b/lib/engines/content_block_manager/config/locales/en.yml @@ -0,0 +1,5 @@ +en: + activerecord: + attributes: + content_block_manager/content_block/edition/document: + title: Title diff --git a/lib/engines/content_object_store/config/routes.rb b/lib/engines/content_block_manager/config/routes.rb similarity index 86% rename from lib/engines/content_object_store/config/routes.rb rename to lib/engines/content_block_manager/config/routes.rb index ba7e71bb673..636d828ff1e 100644 --- a/lib/engines/content_object_store/config/routes.rb +++ b/lib/engines/content_block_manager/config/routes.rb @@ -1,5 +1,5 @@ -ContentObjectStore::Engine.routes.draw do - namespace :content_object_store, path: "/" do +ContentBlockManager::Engine.routes.draw do + namespace :content_block_manager, path: "/" do root to: "content_block/documents#index", via: :get namespace :content_block, path: "content-block" do diff --git a/lib/engines/content_object_store/features/content_object_store.feature b/lib/engines/content_block_manager/features/content_block_manager.feature similarity index 70% rename from lib/engines/content_object_store/features/content_object_store.feature rename to lib/engines/content_block_manager/features/content_block_manager.feature index b042e4b87e6..4205b86e362 100644 --- a/lib/engines/content_object_store/features/content_object_store.feature +++ b/lib/engines/content_block_manager/features/content_block_manager.feature @@ -1,7 +1,7 @@ -Feature: Content object store +Feature: Content block manager Scenario: Correct layout is used - Given the content object store feature flag is enabled + Given the content block manager feature flag is enabled Given I am a GDS admin When I visit the document object store Then I should see the object store's title in the header diff --git a/lib/engines/content_object_store/features/create_object.feature b/lib/engines/content_block_manager/features/create_object.feature similarity index 97% rename from lib/engines/content_object_store/features/create_object.feature rename to lib/engines/content_block_manager/features/create_object.feature index 3e507b0e53f..d458173fb61 100644 --- a/lib/engines/content_object_store/features/create_object.feature +++ b/lib/engines/content_block_manager/features/create_object.feature @@ -1,7 +1,7 @@ Feature: Create a content object Background: - Given the content object store feature flag is enabled + Given the content block manager feature flag is enabled Given I am a GDS admin And the organisation "Ministry of Example" exists And a schema "email_address" exists with the following fields: diff --git a/lib/engines/content_object_store/features/edit_object.feature b/lib/engines/content_block_manager/features/edit_object.feature similarity index 98% rename from lib/engines/content_object_store/features/edit_object.feature rename to lib/engines/content_block_manager/features/edit_object.feature index fdca7367a1d..68ad3f8d303 100644 --- a/lib/engines/content_object_store/features/edit_object.feature +++ b/lib/engines/content_block_manager/features/edit_object.feature @@ -1,6 +1,6 @@ Feature: Edit a content object Background: - Given the content object store feature flag is enabled + Given the content block manager feature flag is enabled And I am a GDS admin And the organisation "Ministry of Example" exists And a schema "email_address" exists with the following fields: diff --git a/lib/engines/content_object_store/features/object_store_feature_flag.feature b/lib/engines/content_block_manager/features/object_store_feature_flag.feature similarity index 79% rename from lib/engines/content_object_store/features/object_store_feature_flag.feature rename to lib/engines/content_block_manager/features/object_store_feature_flag.feature index 73c20cd264a..3841b4df0d2 100644 --- a/lib/engines/content_object_store/features/object_store_feature_flag.feature +++ b/lib/engines/content_block_manager/features/object_store_feature_flag.feature @@ -1,7 +1,7 @@ Feature: Create a content object when feature flag is disabled Background: - Given the content object store feature flag is disabled + Given the content block manager feature flag is disabled Given I am a GDS admin Scenario: GDS editor visits object store diff --git a/lib/engines/content_object_store/features/schedule_object.feature b/lib/engines/content_block_manager/features/schedule_object.feature similarity index 97% rename from lib/engines/content_object_store/features/schedule_object.feature rename to lib/engines/content_block_manager/features/schedule_object.feature index 7622453cbb1..658325230b7 100644 --- a/lib/engines/content_object_store/features/schedule_object.feature +++ b/lib/engines/content_block_manager/features/schedule_object.feature @@ -1,6 +1,6 @@ Feature: Schedule a content object Background: - Given the content object store feature flag is enabled + Given the content block manager feature flag is enabled And I am a GDS admin And the organisation "Ministry of Example" exists And a schema "email_address" exists with the following fields: diff --git a/lib/engines/content_object_store/features/step_definitions/content_object_store_steps.rb b/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb similarity index 81% rename from lib/engines/content_object_store/features/step_definitions/content_object_store_steps.rb rename to lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb index 87c209ef5d7..474784f30c5 100644 --- a/lib/engines/content_object_store/features/step_definitions/content_object_store_steps.rb +++ b/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb @@ -5,9 +5,9 @@ cfg.logger.level = ::Logger::WARN end -Given(/^the content object store feature flag is (enabled|disabled)$/) do |enabled| +Given(/^the content block manager feature flag is (enabled|disabled)$/) do |enabled| @test_strategy ||= Flipflop::FeatureSet.current.test! - @test_strategy.switch!(:content_object_store, enabled == "enabled") + @test_strategy.switch!(:content_block_manager, enabled == "enabled") end Given("a schema {string} exists with the following fields:") do |block_type, table| @@ -22,11 +22,11 @@ }.to_h, } @schemas[block_type] = build(:content_block_schema, block_type:, body:) - ContentObjectStore::ContentBlock::Schema.stubs(:all).returns(@schemas.values) + ContentBlockManager::ContentBlock::Schema.stubs(:all).returns(@schemas.values) end When("I access the create object page") do - visit content_object_store.new_content_object_store_content_block_edition_path + visit content_block_manager.new_content_block_manager_content_block_edition_path end When("I click to create an object") do @@ -41,7 +41,7 @@ When("I click on the {string} schema") do |schema_id| @schema = @schemas[schema_id] - ContentObjectStore::ContentBlock::Schema.expects(:find_by_block_type).with(schema_id).at_least_once.returns(@schema) + ContentBlockManager::ContentBlock::Schema.expects(:find_by_block_type).with(schema_id).at_least_once.returns(@schema) choose @schema.name click_save_and_continue end @@ -51,17 +51,17 @@ end Then("I should see a back link to the document list page") do - expect(page).to have_link("Back", href: content_object_store.content_object_store_content_block_documents_path) + expect(page).to have_link("Back", href: content_block_manager.content_block_manager_content_block_documents_path) end Then("I should see a back link to the select schema page") do - expect(page).to have_link("Back", href: content_object_store.new_content_object_store_content_block_document_path) + expect(page).to have_link("Back", href: content_block_manager.new_content_block_manager_content_block_document_path) end Then("I should see a back link to the document page") do expect(page).to have_link( "Back", - href: content_object_store.content_object_store_content_block_document_path(@content_block.document), + href: content_block_manager.content_block_manager_content_block_document_path(@content_block.document), ) end @@ -69,13 +69,13 @@ match_data = URI.parse(page.current_url).path.match(%r{content-block-editions/(\d+)/edit$}) id = match_data[1] unless match_data.nil? expect(id).not_to be_nil, "Could not find an existing content block edition ID in the URL" - expect(page).to have_link("Back", href: content_object_store.content_object_store_content_block_edition_path(id)) + expect(page).to have_link("Back", href: content_block_manager.content_block_manager_content_block_edition_path(id)) end Then("I should see a back link to the edit page") do expect(page).to have_link( "Back", - href: content_object_store.new_content_object_store_content_block_edition_path(@content_block.document), + href: content_block_manager.new_content_block_manager_content_block_edition_path(@content_block.document), ) end @@ -97,7 +97,7 @@ select @organisation, from: "content_block/edition_lead_organisation" fields.keys.each do |k| - fill_in "content_object_store/content_block/edition_details_#{k}", with: @details[k] + fill_in "content_block_manager/content_block/edition_details_#{k}", with: @details[k] end click_save_and_continue @@ -109,7 +109,7 @@ fill_in "Title", with: @title @details.keys.each do |k| - fill_in "content_object_store/content_block_edition_details_#{k}", with: @details[k] + fill_in "content_block_manager/content_block_edition_details_#{k}", with: @details[k] end click_save_and_continue end @@ -117,7 +117,7 @@ Then("the edition should have been created successfully") do assert_text "#{@schema.name} created successfully" - edition = ContentObjectStore::ContentBlock::Edition.all.last + edition = ContentBlockManager::ContentBlock::Edition.all.last assert_not_nil edition assert_not_nil edition.document @@ -129,8 +129,8 @@ end Then("I should be taken back to the document page") do - expect(page.current_url).to match(content_object_store.content_object_store_content_block_document_path( - ContentObjectStore::ContentBlock::Edition.last.document, + expect(page.current_url).to match(content_block_manager.content_block_manager_content_block_document_path( + ContentBlockManager::ContentBlock::Edition.last.document, )) end @@ -145,24 +145,24 @@ creator: @user, organisation:, ) - ContentObjectStore::ContentBlock::Edition::HasAuditTrail.acting_as(@user) do + ContentBlockManager::ContentBlock::Edition::HasAuditTrail.acting_as(@user) do @content_block.publish! end @content_blocks.push(@content_block) end When("I visit the page for the content block") do - visit content_object_store.content_object_store_content_block_edition_path(@content_block) + visit content_block_manager.content_block_manager_content_block_edition_path(@content_block) end When("I visit the document object store") do - visit content_object_store.content_object_store_content_block_documents_path + visit content_block_manager.content_block_manager_content_block_documents_path end Then("I should see the details for all documents") do assert_text "All content blocks" - ContentObjectStore::ContentBlock::Document.find_each do |document| + ContentBlockManager::ContentBlock::Document.find_each do |document| should_show_summary_card_for_email_address_content_block( document.title, document.latest_edition.details[:email_address], @@ -172,12 +172,12 @@ When("I click to view the document") do @schema = @schemas[@content_block.document.block_type] - click_link href: content_object_store.content_object_store_content_block_document_path(@content_block.document) + click_link href: content_block_manager.content_block_manager_content_block_document_path(@content_block.document) end When("I click to view the edition") do @schema = @schemas[@content_block.document.block_type] - click_link href: content_object_store.content_object_store_content_block_edition_path(@content_block) + click_link href: content_block_manager.content_block_manager_content_block_edition_path(@content_block) end Then("I should see the details for the email address content block") do @@ -191,7 +191,7 @@ end When("I click the first change link") do - first_link = find("a[href='#{content_object_store.new_content_object_store_content_block_document_edition_path(@content_block.document)}']", match: :first) + first_link = find("a[href='#{content_block_manager.new_content_block_manager_content_block_document_edition_path(@content_block.document)}']", match: :first) first_link.click end @@ -253,7 +253,7 @@ def should_show_edit_form_for_email_address_content_block(document_title, email_ required_fields = @schema.body["required"] required_fields.each do |required_field| - assert_text "#{ContentObjectStore::ContentBlock::Edition.human_attribute_name("details_#{required_field}")} cannot be blank" + assert_text "#{ContentBlockManager::ContentBlock::Edition.human_attribute_name("details_#{required_field}")} cannot be blank" end assert_text "Lead organisation cannot be blank" end @@ -271,7 +271,7 @@ def should_show_edit_form_for_email_address_content_block(document_title, email_ end Then("I should see a message that the {string} field is an invalid {string}") do |field_name, format| - assert_text "#{ContentObjectStore::ContentBlock::Edition.human_attribute_name("details_#{field_name}")} is an invalid #{format.titleize}" + assert_text "#{ContentBlockManager::ContentBlock::Edition.human_attribute_name("details_#{field_name}")} is an invalid #{format.titleize}" end Then("I should see a permissions error") do @@ -369,7 +369,7 @@ def should_show_edit_form_for_email_address_content_block(document_title, email_ When("I am updating a content block") do # go to the edit page for the block - visit content_object_store.new_content_object_store_content_block_document_edition_path(@content_block.document) + visit content_block_manager.new_content_block_manager_content_block_document_edition_path(@content_block.document) # fill in the new data change_details # accept changes @@ -415,7 +415,7 @@ def should_show_edit_form_for_email_address_content_block(document_title, email_ end Then("published state of the object is shown") do - visit content_object_store.content_object_store_content_block_document_path(@content_block.document) + visit content_block_manager.content_block_manager_content_block_document_path(@content_block.document) expect(page).to have_selector(".govuk-summary-list__key", text: "State") expect(page).to have_selector(".govuk-summary-list__value", text: "Published") end @@ -430,7 +430,7 @@ def should_show_edit_form_for_email_address_content_block(document_title, email_ end def visit_edit_page - visit content_object_store.new_content_object_store_content_block_document_edition_path(@content_block.document) + visit content_block_manager.new_content_block_manager_content_block_document_edition_path(@content_block.document) end def change_details @@ -445,11 +445,11 @@ def click_save_and_continue end Then(/^I should see the object store's title in the header$/) do - expect(page).to have_selector(".govuk-header__product-name", text: "Content Object Store") + expect(page).to have_selector(".govuk-header__product-name", text: "Content Block Manager") end And(/^I should see the object store's navigation$/) do - expect(page).to have_selector("a.govuk-header__link[href='#{content_object_store.content_object_store_root_path}']", text: "Dashboard") + expect(page).to have_selector("a.govuk-header__link[href='#{content_block_manager.content_block_manager_root_path}']", text: "Dashboard") end Then(/^I should still see the live edition on the homepage$/) do diff --git a/lib/engines/content_object_store/features/support/stubs.rb b/lib/engines/content_block_manager/features/support/stubs.rb similarity index 100% rename from lib/engines/content_object_store/features/support/stubs.rb rename to lib/engines/content_block_manager/features/support/stubs.rb diff --git a/lib/engines/content_object_store/features/view_object.feature b/lib/engines/content_block_manager/features/view_object.feature similarity index 93% rename from lib/engines/content_object_store/features/view_object.feature rename to lib/engines/content_block_manager/features/view_object.feature index 7aa57d9819d..3567d9aac42 100644 --- a/lib/engines/content_object_store/features/view_object.feature +++ b/lib/engines/content_block_manager/features/view_object.feature @@ -1,6 +1,6 @@ Feature: View a content object Background: - Given the content object store feature flag is enabled + Given the content block manager feature flag is enabled Given I am a GDS admin And the organisation "Ministry of Example" exists And a schema "email_address" exists with the following fields: diff --git a/lib/engines/content_block_manager/lib/content_block_manager.rb b/lib/engines/content_block_manager/lib/content_block_manager.rb new file mode 100644 index 00000000000..854b0fed6ef --- /dev/null +++ b/lib/engines/content_block_manager/lib/content_block_manager.rb @@ -0,0 +1,4 @@ +require_relative "content_block_manager/engine" + +module ContentBlockManager +end diff --git a/lib/engines/content_object_store/lib/content_object_store/engine.rb b/lib/engines/content_block_manager/lib/content_block_manager/engine.rb similarity index 73% rename from lib/engines/content_object_store/lib/content_object_store/engine.rb rename to lib/engines/content_block_manager/lib/content_block_manager/engine.rb index 55f2859011c..390b5f8b2ba 100644 --- a/lib/engines/content_object_store/lib/content_object_store/engine.rb +++ b/lib/engines/content_block_manager/lib/content_block_manager/engine.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module ContentObjectStore +module ContentBlockManager class Engine < ::Rails::Engine end end diff --git a/lib/engines/content_object_store/test/components/content_block/document/index/summary_card_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/document/index/summary_card_component_test.rb similarity index 81% rename from lib/engines/content_object_store/test/components/content_block/document/index/summary_card_component_test.rb rename to lib/engines/content_block_manager/test/components/content_block/document/index/summary_card_component_test.rb index d1e38dd7dce..32a4cdf421a 100644 --- a/lib/engines/content_object_store/test/components/content_block/document/index/summary_card_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/document/index/summary_card_component_test.rb @@ -1,9 +1,9 @@ require "test_helper" -class ContentObjectStore::ContentBlock::Document::Index::SummaryCardComponentTest < ViewComponent::TestCase +class ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponentTest < ViewComponent::TestCase extend Minitest::Spec::DSL - include ContentObjectStore::Engine.routes.url_helpers + include ContentBlockManager::Engine.routes.url_helpers let(:content_block_edition) do create( @@ -21,11 +21,11 @@ class ContentObjectStore::ContentBlock::Document::Index::SummaryCardComponentTes let(:content_block_document) { content_block_edition.document } it "renders a published content block as a summary card" do - render_inline(ContentObjectStore::ContentBlock::Document::Index::SummaryCardComponent.new(content_block_document:)) + render_inline(ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponent.new(content_block_document:)) assert_selector ".govuk-summary-card__title", text: content_block_edition.title assert_selector ".govuk-summary-card__action", count: 1 - assert_selector ".govuk-summary-card__action .govuk-link[href='#{content_object_store_content_block_document_path(content_block_document)}']" + assert_selector ".govuk-summary-card__action .govuk-link[href='#{content_block_manager_content_block_document_path(content_block_document)}']" assert_selector ".govuk-summary-list__row", count: 7 @@ -54,7 +54,7 @@ class ContentObjectStore::ContentBlock::Document::Index::SummaryCardComponentTes it "renders a scheduled content block as a summary card" do content_block_document.latest_edition.state = "scheduled" - render_inline(ContentObjectStore::ContentBlock::Document::Index::SummaryCardComponent.new(content_block_document:)) + render_inline(ContentBlockManager::ContentBlock::Document::Index::SummaryCardComponent.new(content_block_document:)) assert_selector ".govuk-summary-list__row", count: 8 diff --git a/lib/engines/content_object_store/test/components/content_block/document/show/document_timeline_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/document/show/document_timeline_component_test.rb similarity index 85% rename from lib/engines/content_object_store/test/components/content_block/document/show/document_timeline_component_test.rb rename to lib/engines/content_block_manager/test/components/content_block/document/show/document_timeline_component_test.rb index 72226dee1c6..f71a3876963 100644 --- a/lib/engines/content_object_store/test/components/content_block/document/show/document_timeline_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/document/show/document_timeline_component_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::ContentBlock::Document::Show::DocumentTimelineComponentTest < ViewComponent::TestCase +class ContentBlockManager::ContentBlock::Document::Show::DocumentTimelineComponentTest < ViewComponent::TestCase test "renders a timeline component with events in correct order" do @user = create(:user) @version_1 = create( @@ -21,7 +21,7 @@ class ContentObjectStore::ContentBlock::Document::Show::DocumentTimelineComponen state: "scheduled", ) - render_inline(ContentObjectStore::ContentBlock::Document::Show::DocumentTimelineComponent.new( + render_inline(ContentBlockManager::ContentBlock::Document::Show::DocumentTimelineComponent.new( content_block_versions: [@version_3, @version_2, @version_1], )) diff --git a/lib/engines/content_object_store/test/components/content_block/document/show/host_editions_table_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/document/show/host_editions_table_component_test.rb similarity index 90% rename from lib/engines/content_object_store/test/components/content_block/document/show/host_editions_table_component_test.rb rename to lib/engines/content_block_manager/test/components/content_block/document/show/host_editions_table_component_test.rb index 3c2e1738dde..9ebc1d9c50e 100644 --- a/lib/engines/content_object_store/test/components/content_block/document/show/host_editions_table_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/document/show/host_editions_table_component_test.rb @@ -1,14 +1,14 @@ require "test_helper" -class ContentObjectStore::ContentBlock::Document::Show::HostEditionsTableComponentTest < ViewComponent::TestCase +class ContentBlockManager::ContentBlock::Document::Show::HostEditionsTableComponentTest < ViewComponent::TestCase extend Minitest::Spec::DSL include Rails.application.routes.url_helpers - let(:described_class) { ContentObjectStore::ContentBlock::Document::Show::HostEditionsTableComponent } + let(:described_class) { ContentBlockManager::ContentBlock::Document::Show::HostEditionsTableComponent } let(:host_content_items) do [ - ContentObjectStore::HostContentItem.new( + ContentBlockManager::HostContentItem.new( "title" => "Some title", "base_path" => "/foo", "document_type" => "document_type", @@ -75,7 +75,7 @@ class ContentObjectStore::ContentBlock::Document::Show::HostEditionsTableCompone context "when the organisation recieved does not have a title or base_path" do let(:host_content_items) do [ - ContentObjectStore::HostContentItem.new( + ContentBlockManager::HostContentItem.new( title: "Some title", base_path: "/foo", document_type: "document_type", diff --git a/lib/engines/content_object_store/test/components/content_block/document/show/summary_list_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/document/show/summary_list_component_test.rb similarity index 86% rename from lib/engines/content_object_store/test/components/content_block/document/show/summary_list_component_test.rb rename to lib/engines/content_block_manager/test/components/content_block/document/show/summary_list_component_test.rb index a0027f115dc..739b2a4c63f 100644 --- a/lib/engines/content_object_store/test/components/content_block/document/show/summary_list_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/document/show/summary_list_component_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::ContentBlock::Document::Show::SummaryListComponentTest < ViewComponent::TestCase +class ContentBlockManager::ContentBlock::Document::Show::SummaryListComponentTest < ViewComponent::TestCase extend Minitest::Spec::DSL let(:organisation) { create(:organisation, name: "Department for Example") } @@ -18,7 +18,7 @@ class ContentObjectStore::ContentBlock::Document::Show::SummaryListComponentTest let(:content_block_document) { content_block_edition.document } it "renders a published content block correctly" do - render_inline(ContentObjectStore::ContentBlock::Document::Show::SummaryListComponent.new(content_block_document:)) + render_inline(ContentBlockManager::ContentBlock::Document::Show::SummaryListComponent.new(content_block_document:)) assert_selector ".govuk-summary-list__row", count: 7 assert_selector ".govuk-summary-list__key", text: "Title" @@ -49,7 +49,7 @@ class ContentObjectStore::ContentBlock::Document::Show::SummaryListComponentTest it "renders a scheduled content block correctly" do content_block_document.latest_edition.state = "scheduled" - render_inline(ContentObjectStore::ContentBlock::Document::Show::SummaryListComponent.new(content_block_document:)) + render_inline(ContentBlockManager::ContentBlock::Document::Show::SummaryListComponent.new(content_block_document:)) assert_selector ".govuk-summary-list__row", count: 8 diff --git a/lib/engines/content_object_store/test/components/content_block/edition/new/error_summary_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/edition/new/error_summary_component_test.rb similarity index 74% rename from lib/engines/content_object_store/test/components/content_block/edition/new/error_summary_component_test.rb rename to lib/engines/content_block_manager/test/components/content_block/edition/new/error_summary_component_test.rb index 9f89198eaa7..7cfa14f1150 100644 --- a/lib/engines/content_object_store/test/components/content_block/edition/new/error_summary_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/edition/new/error_summary_component_test.rb @@ -1,10 +1,10 @@ require "test_helper" -class ContentObjectStore::ContentBlockEdition::New::ErrorSummaryComponentTest < ViewComponent::TestCase +class ContentBlockManager::ContentBlockEdition::New::ErrorSummaryComponentTest < ViewComponent::TestCase extend Minitest::Spec::DSL let(:component) do - ContentObjectStore::ContentBlockEdition::New::ErrorSummaryComponent.new(error_message:) + ContentBlockManager::ContentBlockEdition::New::ErrorSummaryComponent.new(error_message:) end describe "when a message is present" do diff --git a/lib/engines/content_object_store/test/components/content_block/edition/new/select_schema_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/edition/new/select_schema_component_test.rb similarity index 85% rename from lib/engines/content_object_store/test/components/content_block/edition/new/select_schema_component_test.rb rename to lib/engines/content_block_manager/test/components/content_block/edition/new/select_schema_component_test.rb index e63f7c2262b..dc2dca8b88e 100644 --- a/lib/engines/content_object_store/test/components/content_block/edition/new/select_schema_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/edition/new/select_schema_component_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::ContentBlockEdition::New::SelectSchemaComponentTest < ViewComponent::TestCase +class ContentBlockManager::ContentBlockEdition::New::SelectSchemaComponentTest < ViewComponent::TestCase extend Minitest::Spec::DSL let(:heading) { "Some heading" } @@ -9,7 +9,7 @@ class ContentObjectStore::ContentBlockEdition::New::SelectSchemaComponentTest < let(:schemas) { build_list(:content_block_schema, 3) } let(:component) do - ContentObjectStore::ContentBlockEdition::New::SelectSchemaComponent.new( + ContentBlockManager::ContentBlockEdition::New::SelectSchemaComponent.new( heading:, heading_caption:, error_message:, diff --git a/lib/engines/content_object_store/test/components/content_block/edition/show/confirm_summary_list_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/edition/show/confirm_summary_list_component_test.rb similarity index 84% rename from lib/engines/content_object_store/test/components/content_block/edition/show/confirm_summary_list_component_test.rb rename to lib/engines/content_block_manager/test/components/content_block/edition/show/confirm_summary_list_component_test.rb index e40cbffd5e9..cc6da840674 100644 --- a/lib/engines/content_object_store/test/components/content_block/edition/show/confirm_summary_list_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/edition/show/confirm_summary_list_component_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::ContentBlockEdition::Show::ConfirmSummaryListComponentTest < ViewComponent::TestCase +class ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponentTest < ViewComponent::TestCase test "renders a summary list component with the edition details to confirm" do organisation = create(:organisation, name: "Department for Example") @@ -11,7 +11,7 @@ class ContentObjectStore::ContentBlockEdition::Show::ConfirmSummaryListComponent organisation:, ) - render_inline(ContentObjectStore::ContentBlockEdition::Show::ConfirmSummaryListComponent.new( + render_inline(ContentBlockManager::ContentBlockEdition::Show::ConfirmSummaryListComponent.new( content_block_edition:, )) diff --git a/lib/engines/content_object_store/test/factories/content_block_document.rb b/lib/engines/content_block_manager/test/factories/content_block_document.rb similarity index 64% rename from lib/engines/content_object_store/test/factories/content_block_document.rb rename to lib/engines/content_block_manager/test/factories/content_block_document.rb index e111b292762..def828691b1 100644 --- a/lib/engines/content_object_store/test/factories/content_block_document.rb +++ b/lib/engines/content_block_manager/test/factories/content_block_document.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :content_block_document, class: "ContentObjectStore::ContentBlock::Document" do + factory :content_block_document, class: "ContentBlockManager::ContentBlock::Document" do sequence(:content_id) { SecureRandom.uuid } title { "Title" } created_at { Time.zone.now.utc } @@ -7,7 +7,7 @@ latest_edition_id { nil } live_edition_id { nil } - ContentObjectStore::ContentBlock::Schema.valid_schemas.each do |type| + ContentBlockManager::ContentBlock::Schema.valid_schemas.each do |type| trait type.to_sym do block_type { type } end diff --git a/lib/engines/content_object_store/test/factories/content_block_edition.rb b/lib/engines/content_block_manager/test/factories/content_block_edition.rb similarity index 83% rename from lib/engines/content_object_store/test/factories/content_block_edition.rb rename to lib/engines/content_block_manager/test/factories/content_block_edition.rb index 388ebf1f7af..fadfe2354d7 100644 --- a/lib/engines/content_object_store/test/factories/content_block_edition.rb +++ b/lib/engines/content_block_manager/test/factories/content_block_edition.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :content_block_edition, class: "ContentObjectStore::ContentBlock::Edition" do + factory :content_block_edition, class: "ContentBlockManager::ContentBlock::Edition" do details { {} } created_at { Time.zone.now.utc } updated_at { Time.zone.now.utc } @@ -12,7 +12,7 @@ scheduled_publication { nil } - ContentObjectStore::ContentBlock::Schema.valid_schemas.each do |type| + ContentBlockManager::ContentBlock::Schema.valid_schemas.each do |type| trait type.to_sym do document { build(:content_block_document, block_type: type) } end diff --git a/lib/engines/content_block_manager/test/factories/content_block_edition_organisation.rb b/lib/engines/content_block_manager/test/factories/content_block_edition_organisation.rb new file mode 100644 index 00000000000..fdc5d09682e --- /dev/null +++ b/lib/engines/content_block_manager/test/factories/content_block_edition_organisation.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :content_block_edition_organisation, class: "ContentBlockManager::ContentBlock::EditionOrganisation" do + edition {} + organisation {} + end +end diff --git a/lib/engines/content_block_manager/test/factories/content_block_schema.rb b/lib/engines/content_block_manager/test/factories/content_block_schema.rb new file mode 100644 index 00000000000..0168f5c7a30 --- /dev/null +++ b/lib/engines/content_block_manager/test/factories/content_block_schema.rb @@ -0,0 +1,16 @@ +FactoryBot.define do + factory :content_block_schema, class: "ContentBlockManager::ContentBlock::Schema" do + body { {} } + block_type { "block_type" } + + ContentBlockManager::ContentBlock::Schema.valid_schemas.each do |type| + trait type.to_sym do + block_type { type } + end + end + + initialize_with do + new("#{ContentBlockManager::ContentBlock::Schema::SCHEMA_PREFIX}_#{block_type}", body) + end + end +end diff --git a/lib/engines/content_object_store/test/factories/content_block_version.rb b/lib/engines/content_block_manager/test/factories/content_block_version.rb similarity index 76% rename from lib/engines/content_object_store/test/factories/content_block_version.rb rename to lib/engines/content_block_manager/test/factories/content_block_version.rb index 42ae1736385..e680b3b9b64 100644 --- a/lib/engines/content_object_store/test/factories/content_block_version.rb +++ b/lib/engines/content_block_manager/test/factories/content_block_version.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :content_block_version, class: "ContentObjectStore::ContentBlock::Version" do + factory :content_block_version, class: "ContentBlockManager::ContentBlock::Version" do event { "created" } item do create( diff --git a/lib/engines/content_object_store/test/factories/host_content_item.rb b/lib/engines/content_block_manager/test/factories/host_content_item.rb similarity index 81% rename from lib/engines/content_object_store/test/factories/host_content_item.rb rename to lib/engines/content_block_manager/test/factories/host_content_item.rb index 03ee73cecac..309df6c2f70 100644 --- a/lib/engines/content_object_store/test/factories/host_content_item.rb +++ b/lib/engines/content_block_manager/test/factories/host_content_item.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :host_content_item, class: "ContentObjectStore::HostContentItem" do + factory :host_content_item, class: "ContentBlockManager::HostContentItem" do title { "title" } base_path { "/foo/bar" } document_type { "something" } diff --git a/lib/engines/content_block_manager/test/functional/base_controller_test.rb b/lib/engines/content_block_manager/test/functional/base_controller_test.rb new file mode 100644 index 00000000000..5996cc8c3fa --- /dev/null +++ b/lib/engines/content_block_manager/test/functional/base_controller_test.rb @@ -0,0 +1,5 @@ +require "test_helper" + +class ContentBlockManager::BaseControllerTest < ActionController::TestCase + should_be_an_admin_controller +end diff --git a/lib/engines/content_object_store/test/functional/content_block/editions_controller_test.rb b/lib/engines/content_block_manager/test/functional/content_block/editions_controller_test.rb similarity index 50% rename from lib/engines/content_object_store/test/functional/content_block/editions_controller_test.rb rename to lib/engines/content_block_manager/test/functional/content_block/editions_controller_test.rb index e625958c53b..39ab91a1c3e 100644 --- a/lib/engines/content_object_store/test/functional/content_block/editions_controller_test.rb +++ b/lib/engines/content_block_manager/test/functional/content_block/editions_controller_test.rb @@ -1,8 +1,8 @@ require "test_helper" -class ContentObjectStore::ContentBlock::EditionsControllerTest < ActionController::TestCase +class ContentBlockManager::ContentBlock::EditionsControllerTest < ActionController::TestCase test "should inherit from base controller" do - assert @controller.is_a?(ContentObjectStore::BaseController), + assert @controller.is_a?(ContentBlockManager::BaseController), "the controller should inherit from the object store's base controller" end end diff --git a/lib/engines/content_object_store/test/integration/base_test.rb b/lib/engines/content_block_manager/test/integration/base_test.rb similarity index 65% rename from lib/engines/content_object_store/test/integration/base_test.rb rename to lib/engines/content_block_manager/test/integration/base_test.rb index 9dda5247f7f..911537fe9c2 100644 --- a/lib/engines/content_object_store/test/integration/base_test.rb +++ b/lib/engines/content_block_manager/test/integration/base_test.rb @@ -1,14 +1,14 @@ require "test_helper" -class TestController < ContentObjectStore::BaseController +class TestController < ContentBlockManager::BaseController def index render plain: "response", status: :ok end end -class ContentObjectStore::BaseTest < ActionDispatch::IntegrationTest +class ContentBlockManager::BaseTest < ActionDispatch::IntegrationTest setup do - feature_flags.switch!(:content_object_store, true) + feature_flags.switch!(:content_block_manager, true) login_as_admin @controller = TestController.new @@ -24,7 +24,7 @@ class ContentObjectStore::BaseTest < ActionDispatch::IntegrationTest test "sentry tags are set in a before filter" do mock = Minitest::Mock.new - mock.expect(:call, nil, engine: "content_object_store") + mock.expect(:call, nil, engine: "content_block_manager") Sentry.stub(:set_tags, mock) do get "/test" diff --git a/lib/engines/content_object_store/test/integration/content_block/documents_test.rb b/lib/engines/content_block_manager/test/integration/content_block/documents_test.rb similarity index 63% rename from lib/engines/content_object_store/test/integration/content_block/documents_test.rb rename to lib/engines/content_block_manager/test/integration/content_block/documents_test.rb index 8cc1cb59285..12f6f208454 100644 --- a/lib/engines/content_object_store/test/integration/content_block/documents_test.rb +++ b/lib/engines/content_block_manager/test/integration/content_block/documents_test.rb @@ -1,15 +1,15 @@ require "test_helper" require "capybara/rails" -class ContentObjectStore::ContentBlock::DocumentsTest < ActionDispatch::IntegrationTest +class ContentBlockManager::ContentBlock::DocumentsTest < ActionDispatch::IntegrationTest include Capybara::DSL extend Minitest::Spec::DSL - include ContentObjectStore::Engine.routes.url_helpers + include ContentBlockManager::Engine.routes.url_helpers setup do login_as_admin - feature_flags.switch!(:content_object_store, true) + feature_flags.switch!(:content_block_manager, true) end describe "#index" do @@ -28,7 +28,7 @@ class ContentObjectStore::ContentBlock::DocumentsTest < ActionDispatch::Integrat document_id: content_block_document.id, ) - visit content_object_store.content_object_store_content_block_documents_path + visit content_block_manager.content_block_manager_content_block_documents_path assert_no_text first_edition.details["email_address"] assert_text second_edition.details["email_address"] @@ -43,9 +43,9 @@ class ContentObjectStore::ContentBlock::DocumentsTest < ActionDispatch::Integrat document_id: document_with_latest_edition.id, ) - ContentObjectStore::ContentBlock::Document.expects(:live).returns([document_with_latest_edition]) + ContentBlockManager::ContentBlock::Document.expects(:live).returns([document_with_latest_edition]) - visit content_object_store.content_object_store_content_block_documents_path + visit content_block_manager.content_block_manager_content_block_documents_path assert_text document_with_latest_edition.latest_edition.details["email_address"] end @@ -55,9 +55,9 @@ class ContentObjectStore::ContentBlock::DocumentsTest < ActionDispatch::Integrat let(:schemas) { build_list(:content_block_schema, 1, body: { "properties" => {} }) } it "lists all schemas" do - ContentObjectStore::ContentBlock::Schema.expects(:all).returns(schemas) + ContentBlockManager::ContentBlock::Schema.expects(:all).returns(schemas) - visit new_content_object_store_content_block_document_path + visit new_content_block_manager_content_block_document_path assert_text "Select a block type" end @@ -67,25 +67,25 @@ class ContentObjectStore::ContentBlock::DocumentsTest < ActionDispatch::Integrat let(:schemas) { build_list(:content_block_schema, 1, body: { "properties" => {} }) } before do - ContentObjectStore::ContentBlock::Schema.stubs(:all).returns(schemas) + ContentBlockManager::ContentBlock::Schema.stubs(:all).returns(schemas) end it "shows an error message when block type is empty" do - post new_document_options_redirect_content_object_store_content_block_documents_path + post new_document_options_redirect_content_block_manager_content_block_documents_path follow_redirect! - assert_equal new_content_object_store_content_block_document_path, path + assert_equal new_content_block_manager_content_block_document_path, path assert_equal "You must select a block type", flash[:error] end it "redirects when the block type is specified" do block_type = schemas[0].block_type - ContentObjectStore::ContentBlock::Schema.stubs(:find_by_block_type).returns(schemas[0]) + ContentBlockManager::ContentBlock::Schema.stubs(:find_by_block_type).returns(schemas[0]) - post new_document_options_redirect_content_object_store_content_block_documents_path, params: { block_type: } + post new_document_options_redirect_content_block_manager_content_block_documents_path, params: { block_type: } follow_redirect! - assert_equal new_content_object_store_content_block_edition_path(block_type:), path + assert_equal new_content_block_manager_content_block_edition_path(block_type:), path end end end diff --git a/lib/engines/content_object_store/test/integration/content_block/editions_test.rb b/lib/engines/content_block_manager/test/integration/content_block/editions_test.rb similarity index 66% rename from lib/engines/content_object_store/test/integration/content_block/editions_test.rb rename to lib/engines/content_block_manager/test/integration/content_block/editions_test.rb index 684d1bda982..4c9a4e87cca 100644 --- a/lib/engines/content_object_store/test/integration/content_block/editions_test.rb +++ b/lib/engines/content_block_manager/test/integration/content_block/editions_test.rb @@ -1,15 +1,15 @@ require "test_helper" require "capybara/rails" -class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::IntegrationTest +class ContentBlockManager::ContentBlock::EditionsTest < ActionDispatch::IntegrationTest include Capybara::DSL extend Minitest::Spec::DSL - include ContentObjectStore::Engine.routes.url_helpers - include ContentObjectStore::IntegrationTestHelpers + include ContentBlockManager::Engine.routes.url_helpers + include ContentBlockManager::IntegrationTestHelpers before do login_as_admin - feature_flags.switch!(:content_object_store, true) + feature_flags.switch!(:content_block_manager, true) end describe "#new" do @@ -18,30 +18,30 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati let(:content_block_document) { create(:content_block_document, :email_address) } it "initializes the form for the latest edition" do - ContentObjectStore::ContentBlock::Document.expects(:find).with(content_block_document.id.to_s).returns(content_block_document) + ContentBlockManager::ContentBlock::Document.expects(:find).with(content_block_document.id.to_s).returns(content_block_document) schema = stub_request_for_schema(content_block_document.block_type) form = stub(:form, title: "title", url: "url", back_path: "back_path", content_block_edition: original_edition, schema:, attributes: {}) - ContentObjectStore::ContentBlock::EditionForm.expects(:for).with( + ContentBlockManager::ContentBlock::EditionForm.expects(:for).with( content_block_edition: original_edition, schema:, ).returns(form) - get content_object_store.new_content_object_store_content_block_document_edition_path(content_block_document) + get content_block_manager.new_content_block_manager_content_block_document_edition_path(content_block_document) end end describe "when a document id is not provided" do it "initializes the form for the latest edition" do edition = create(:content_block_edition, :email_address) - ContentObjectStore::ContentBlock::Edition.expects(:new).returns(edition) + ContentBlockManager::ContentBlock::Edition.expects(:new).returns(edition) schema = stub_request_for_schema("block_type") form = stub(:form, title: "title", url: "url", back_path: "back_path", content_block_edition: edition, schema:, attributes: {}) - ContentObjectStore::ContentBlock::EditionForm.expects(:for).with( + ContentBlockManager::ContentBlock::EditionForm.expects(:for).with( content_block_edition: edition, schema:, ).returns(form) - get content_object_store.new_content_object_store_content_block_edition_path(block_type: "block-type") + get content_block_manager.new_content_block_manager_content_block_edition_path(block_type: "block-type") end end end @@ -71,8 +71,8 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati describe "when updating an existing block" do it "creates a new content block with params generated by the schema" do assert_changes -> { content_block_document.editions.count }, from: 1, to: 2 do - assert_changes -> { ContentObjectStore::ContentBlock::Version.count }, from: 1, to: 2 do - post content_object_store.content_object_store_content_block_document_editions_path(content_block_document), params: { + assert_changes -> { ContentBlockManager::ContentBlock::Version.count }, from: 1, to: 2 do + post content_block_manager.content_block_manager_content_block_document_editions_path(content_block_document), params: { something: "else", "content_block/edition": { document_attributes:, @@ -85,9 +85,9 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati content_block_document.reload new_edition = content_block_document.editions.last - new_author = ContentObjectStore::ContentBlock::EditionAuthor.last - new_version = ContentObjectStore::ContentBlock::Version.last - new_edition_organisation = ContentObjectStore::ContentBlock::EditionOrganisation.last + new_author = ContentBlockManager::ContentBlock::EditionAuthor.last + new_version = ContentBlockManager::ContentBlock::Version.last + new_edition_organisation = ContentBlockManager::ContentBlock::EditionOrganisation.last assert_equal document_attributes[:title], content_block_document.title assert_equal document_attributes[:block_type], content_block_document.block_type @@ -104,7 +104,7 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati it "should render the template when a validation error is raised" do renders_errors do - post content_object_store.content_object_store_content_block_document_editions_path(content_block_document), params: { + post content_block_manager.content_block_manager_content_block_document_editions_path(content_block_document), params: { "content_block/edition": { document_attributes: { block_type: "email_address", @@ -115,8 +115,8 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati end it "redirects to the review links step when successful" do - redirects_to_step(ContentObjectStore::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links]) do - post content_object_store.content_object_store_content_block_document_editions_path(content_block_document), params: { + redirects_to_step(ContentBlockManager::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links]) do + post content_block_manager.content_block_manager_content_block_document_editions_path(content_block_document), params: { "content_block/edition": { document_attributes: { block_type: "email_address", @@ -129,7 +129,7 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati describe "when creating a new block" do it "creates a new content block with params generated by the schema" do - post content_object_store.content_object_store_content_block_editions_path, params: { + post content_block_manager.content_block_manager_content_block_editions_path, params: { something: "else", "content_block/edition": { document_attributes:, @@ -138,11 +138,11 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati }, } - edition = ContentObjectStore::ContentBlock::Edition.last + edition = ContentBlockManager::ContentBlock::Edition.last document = edition.document - author = ContentObjectStore::ContentBlock::EditionAuthor.last - version = ContentObjectStore::ContentBlock::Version.last - edition_organisation = ContentObjectStore::ContentBlock::EditionOrganisation.last + author = ContentBlockManager::ContentBlock::EditionAuthor.last + version = ContentBlockManager::ContentBlock::Version.last + edition_organisation = ContentBlockManager::ContentBlock::EditionOrganisation.last assert_equal document_attributes[:title], document.title assert_equal document_attributes[:block_type], document.block_type @@ -159,7 +159,7 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati it "should render the template when a validation error is raised" do renders_errors do - post content_object_store.content_object_store_content_block_editions_path, params: { + post content_block_manager.content_block_manager_content_block_editions_path, params: { something: "else", "content_block/edition": { document_attributes:, @@ -171,8 +171,8 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati end it "redirects to the review step when successful" do - redirects_to_step(ContentObjectStore::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review]) do - post content_object_store.content_object_store_content_block_editions_path, params: { + redirects_to_step(ContentBlockManager::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review]) do + post content_block_manager.content_block_manager_content_block_editions_path, params: { something: "else", "content_block/edition": { document_attributes:, @@ -188,14 +188,14 @@ class ContentObjectStore::ContentBlock::EditionsTest < ActionDispatch::Integrati def renders_errors(&block) content_block_edition = build(:content_block_edition, :email_address) - ContentObjectStore::CreateEditionService.any_instance.expects(:call).raises(ActiveRecord::RecordInvalid, content_block_edition) + ContentBlockManager::CreateEditionService.any_instance.expects(:call).raises(ActiveRecord::RecordInvalid, content_block_edition) block.call - assert_template "content_object_store/content_block/editions/new" + assert_template "content_block_manager/content_block/editions/new" end def redirects_to_step(step, &block) content_block_edition = build(:content_block_edition, :email_address, id: 123) - ContentObjectStore::CreateEditionService.any_instance.expects(:call).returns(content_block_edition) + ContentBlockManager::CreateEditionService.any_instance.expects(:call).returns(content_block_edition) block.call - assert_redirected_to content_object_store_content_block_workflow_path(id: content_block_edition.id, step:) + assert_redirected_to content_block_manager_content_block_workflow_path(id: content_block_edition.id, step:) end diff --git a/lib/engines/content_object_store/test/integration/content_block/workflow_test.rb b/lib/engines/content_block_manager/test/integration/content_block/workflow_test.rb similarity index 65% rename from lib/engines/content_object_store/test/integration/content_block/workflow_test.rb rename to lib/engines/content_block_manager/test/integration/content_block/workflow_test.rb index 04cfd10bd4f..6aaf995551e 100644 --- a/lib/engines/content_object_store/test/integration/content_block/workflow_test.rb +++ b/lib/engines/content_block_manager/test/integration/content_block/workflow_test.rb @@ -1,12 +1,12 @@ require "test_helper" require "capybara/rails" -class ContentObjectStore::ContentBlock::WorkflowTest < ActionDispatch::IntegrationTest +class ContentBlockManager::ContentBlock::WorkflowTest < ActionDispatch::IntegrationTest include Capybara::DSL extend Minitest::Spec::DSL include SidekiqTestHelpers - include ContentObjectStore::Engine.routes.url_helpers - include ContentObjectStore::IntegrationTestHelpers + include ContentBlockManager::Engine.routes.url_helpers + include ContentBlockManager::IntegrationTestHelpers let(:details) do { @@ -25,20 +25,20 @@ class ContentObjectStore::ContentBlock::WorkflowTest < ActionDispatch::Integrati stub_request_for_schema("email_address") - feature_flags.switch!(:content_object_store, true) + feature_flags.switch!(:content_block_manager, true) stub_publishing_api_has_embedded_content(content_id: @content_id, total: 0, results: []) end describe "when creating a new content block" do describe "when reviewing the changes" do - let(:step) { ContentObjectStore::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review] } + let(:step) { ContentBlockManager::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review] } describe "#show" do it "shows the new edition for review" do - get content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:) + get content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:) - assert_template "content_object_store/content_block/editions/workflow/review" + assert_template "content_block_manager/content_block/editions/workflow/review" assert_equal edition, assigns(:content_block_edition) end end @@ -46,7 +46,7 @@ class ContentObjectStore::ContentBlock::WorkflowTest < ActionDispatch::Integrati describe "#update" do it "posts the new edition to the Publishing API and marks edition as published" do assert_edition_is_published do - put content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:) + put content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:) end end end @@ -55,39 +55,39 @@ class ContentObjectStore::ContentBlock::WorkflowTest < ActionDispatch::Integrati describe "when updating an existing content block" do describe "when reviewing the links" do - let(:step) { ContentObjectStore::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links] } + let(:step) { ContentBlockManager::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links] } describe "#show" do it "shows host content items" do host_content_items = build_list(:host_content_item, 2) - ContentObjectStore::GetHostContentItems.expects(:by_embedded_document) + ContentBlockManager::GetHostContentItems.expects(:by_embedded_document) .with(content_block_document: document) .returns(host_content_items) - get content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:) + get content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:) - assert_template "content_object_store/content_block/editions/workflow/review_links" + assert_template "content_block_manager/content_block/editions/workflow/review_links" assert_equal host_content_items, assigns(:host_content_items) end end describe "#update" do it "redirects to the next step" do - put content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:) + put content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:) - assert_redirected_to content_object_store_content_block_workflow_path(id: edition.id, step: :schedule_publishing) + assert_redirected_to content_block_manager_content_block_workflow_path(id: edition.id, step: :schedule_publishing) end end end describe "when scheduling or publishing" do - let(:step) { ContentObjectStore::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:schedule_publishing] } + let(:step) { ContentBlockManager::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:schedule_publishing] } describe "#show" do it "shows the form" do - get content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:) + get content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:) - assert_template "content_object_store/content_block/editions/workflow/schedule_publishing" + assert_template "content_block_manager/content_block/editions/workflow/schedule_publishing" assert_equal document, assigns(:content_block_document) end end @@ -96,7 +96,7 @@ class ContentObjectStore::ContentBlock::WorkflowTest < ActionDispatch::Integrati describe "when choosing to publish immediately" do it "posts the new edition to the Publishing API and marks edition as published" do assert_edition_is_published do - put content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:), params: { schedule_publishing: "now" } + put content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:), params: { schedule_publishing: "now" } end end end @@ -110,23 +110,23 @@ class ContentObjectStore::ContentBlock::WorkflowTest < ActionDispatch::Integrati "scheduled_publication(4i)": "12", "scheduled_publication(5i)": "00", } - ContentObjectStore::ScheduleEditionService.any_instance.expects(:call).with(edition, ActionController::Parameters.new(scheduled_at).permit!) + ContentBlockManager::ScheduleEditionService.any_instance.expects(:call).with(edition, ActionController::Parameters.new(scheduled_at).permit!) - put content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:), params: { + put content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:), params: { schedule_publishing: "schedule", scheduled_at:, } - assert_redirected_to content_object_store_content_block_document_path(document) + assert_redirected_to content_block_manager_content_block_document_path(document) assert_equal "#{edition.block_type.humanize} scheduled successfully", flash[:notice] end end describe "when leaving the schedule_publishing param blank" do it "shows an error message" do - put content_object_store.content_object_store_content_block_workflow_path(id: edition.id, step:) + put content_block_manager.content_block_manager_content_block_workflow_path(id: edition.id, step:) - assert_template "content_object_store/content_block/editions/workflow/schedule_publishing" + assert_template "content_block_manager/content_block/editions/workflow/schedule_publishing" assert_match(/Schedule publishing cannot be blank/, response.body) end end @@ -168,8 +168,8 @@ def assert_edition_is_published(&block) Services.stub :publishing_api, publishing_api_mock do block.call publishing_api_mock.verify - document = ContentObjectStore::ContentBlock::Document.find_by!(content_id: @content_id) - new_edition = ContentObjectStore::ContentBlock::Edition.find(document.live_edition_id) + document = ContentBlockManager::ContentBlock::Document.find_by!(content_id: @content_id) + new_edition = ContentBlockManager::ContentBlock::Edition.find(document.live_edition_id) assert_equal document.live_edition_id, document.latest_edition_id diff --git a/lib/engines/content_object_store/test/support/integration_test_helpers.rb b/lib/engines/content_block_manager/test/support/integration_test_helpers.rb similarity index 51% rename from lib/engines/content_object_store/test/support/integration_test_helpers.rb rename to lib/engines/content_block_manager/test/support/integration_test_helpers.rb index 0bea536dec4..212b624515d 100644 --- a/lib/engines/content_object_store/test/support/integration_test_helpers.rb +++ b/lib/engines/content_block_manager/test/support/integration_test_helpers.rb @@ -1,7 +1,7 @@ -module ContentObjectStore::IntegrationTestHelpers +module ContentBlockManager::IntegrationTestHelpers def stub_request_for_schema(block_type) schema = stub(id: "content_block_type", fields: %w[foo bar], name: "schema", body: {}, block_type:) - ContentObjectStore::ContentBlock::Schema.stubs(:find_by_block_type).with(block_type).returns(schema) + ContentBlockManager::ContentBlock::Schema.stubs(:find_by_block_type).with(block_type).returns(schema) schema end end diff --git a/lib/engines/content_object_store/test/unit/app/forms/content_object_store/content_block/edition_form_test.rb b/lib/engines/content_block_manager/test/unit/app/forms/content_block_manager/content_block/edition_form_test.rb similarity index 70% rename from lib/engines/content_object_store/test/unit/app/forms/content_object_store/content_block/edition_form_test.rb rename to lib/engines/content_block_manager/test/unit/app/forms/content_block_manager/content_block/edition_form_test.rb index 28af5e2b476..6350203030e 100644 --- a/lib/engines/content_object_store/test/unit/app/forms/content_object_store/content_block/edition_form_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/forms/content_block_manager/content_block/edition_form_test.rb @@ -1,13 +1,13 @@ require "test_helper" -class ContentObjectStore::ContentBlock::EditionFormTest < ActiveSupport::TestCase +class ContentBlockManager::ContentBlock::EditionFormTest < ActiveSupport::TestCase extend Minitest::Spec::DSL - include ContentObjectStore::Engine.routes.url_helpers + include ContentBlockManager::Engine.routes.url_helpers let(:schema) { build(:content_block_schema, :email_address, body: { "properties" => { "foo" => "", "bar" => "" } }) } let(:result) do - ContentObjectStore::ContentBlock::EditionForm.for( + ContentBlockManager::ContentBlock::EditionForm.for( content_block_edition:, schema:, ) @@ -18,7 +18,7 @@ class ContentObjectStore::ContentBlock::EditionFormTest < ActiveSupport::TestCas let(:content_block_edition) { build(:content_block_edition, :email_address, document: content_block_document) } let(:result) do - ContentObjectStore::ContentBlock::EditionForm.for( + ContentBlockManager::ContentBlock::EditionForm.for( content_block_edition:, schema:, ) @@ -37,8 +37,8 @@ class ContentObjectStore::ContentBlock::EditionFormTest < ActiveSupport::TestCas end it "sets the correct urls" do - assert_equal content_object_store_content_block_document_path(id: content_block_edition.document.id), result.back_path - assert_equal content_object_store_content_block_document_editions_path(document_id: content_block_edition.document.id), result.url + assert_equal content_block_manager_content_block_document_path(id: content_block_edition.document.id), result.back_path + assert_equal content_block_manager_content_block_document_editions_path(document_id: content_block_edition.document.id), result.url end end @@ -46,7 +46,7 @@ class ContentObjectStore::ContentBlock::EditionFormTest < ActiveSupport::TestCas let(:content_block_edition) { build(:content_block_edition, :email_address, document: nil) } let(:result) do - ContentObjectStore::ContentBlock::EditionForm.for( + ContentBlockManager::ContentBlock::EditionForm.for( content_block_edition:, schema:, ) @@ -65,8 +65,8 @@ class ContentObjectStore::ContentBlock::EditionFormTest < ActiveSupport::TestCas end it "sets the correct urls" do - assert_equal new_content_object_store_content_block_document_path, result.back_path - assert_equal content_object_store_content_block_editions_path, result.url + assert_equal new_content_block_manager_content_block_document_path, result.back_path + assert_equal content_block_manager_content_block_editions_path, result.url end end end diff --git a/lib/engines/content_object_store/test/unit/app/lib/content_object_store/publishable_test.rb b/lib/engines/content_block_manager/test/unit/app/lib/content_block_manager/publishable_test.rb similarity index 93% rename from lib/engines/content_object_store/test/unit/app/lib/content_object_store/publishable_test.rb rename to lib/engines/content_block_manager/test/unit/app/lib/content_block_manager/publishable_test.rb index 26a7e340b6c..e2a633543bf 100644 --- a/lib/engines/content_object_store/test/unit/app/lib/content_object_store/publishable_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/lib/content_block_manager/publishable_test.rb @@ -1,10 +1,10 @@ require "test_helper" -class ContentObjectStore::PublishableTest < ActiveSupport::TestCase +class ContentBlockManager::PublishableTest < ActiveSupport::TestCase extend Minitest::Spec::DSL class PublishableTestClass - include ContentObjectStore::Publishable + include ContentBlockManager::Publishable end describe "#publish_with_rollback" do diff --git a/lib/engines/content_object_store/test/unit/app/models/content_block_document_test.rb b/lib/engines/content_block_manager/test/unit/app/models/content_block_document_test.rb similarity index 94% rename from lib/engines/content_object_store/test/unit/app/models/content_block_document_test.rb rename to lib/engines/content_block_manager/test/unit/app/models/content_block_document_test.rb index 13d7ae89dd7..829006b5d55 100644 --- a/lib/engines/content_object_store/test/unit/app/models/content_block_document_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/models/content_block_document_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::ContentBlockDocumentTest < ActiveSupport::TestCase +class ContentBlockManager::ContentBlockDocumentTest < ActiveSupport::TestCase extend Minitest::Spec::DSL it "exists with required data" do @@ -79,7 +79,7 @@ class ContentObjectStore::ContentBlockDocumentTest < ActiveSupport::TestCase create(:content_block_document, :email_address, latest_edition_id: nil) - assert_equal [document_with_latest_edition], ContentObjectStore::ContentBlock::Document.live + assert_equal [document_with_latest_edition], ContentBlockManager::ContentBlock::Document.live end end end diff --git a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/has_audit_trail_test.rb b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/has_audit_trail_test.rb similarity index 91% rename from lib/engines/content_object_store/test/unit/app/models/content_block_edition/has_audit_trail_test.rb rename to lib/engines/content_block_manager/test/unit/app/models/content_block_edition/has_audit_trail_test.rb index e068d3e6b1d..39922dcfd9a 100644 --- a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/has_audit_trail_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/has_audit_trail_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::HasAuditTrailTest < ActiveSupport::TestCase +class ContentBlockManager::HasAuditTrailTest < ActiveSupport::TestCase extend Minitest::Spec::DSL describe "record_create" do @@ -48,7 +48,7 @@ def setup test "changes Current.user for the duration of the block, reverting to the original user afterwards" do Current.user = @user - ContentObjectStore::ContentBlock::Edition::HasAuditTrail.acting_as(@user2) do + ContentBlockManager::ContentBlock::Edition::HasAuditTrail.acting_as(@user2) do assert_equal @user2, Current.user end @@ -59,7 +59,7 @@ def setup Current.user = @user assert_raises do - ContentObjectStore::ContentBlock::Edition::HasAuditTrail.acting_as(@user2) { raise "Boom!" } + ContentBlockManager::ContentBlock::Edition::HasAuditTrail.acting_as(@user2) { raise "Boom!" } end assert_equal @user, Current.user diff --git a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/has_lead_organisation_test.rb b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/has_lead_organisation_test.rb similarity index 88% rename from lib/engines/content_object_store/test/unit/app/models/content_block_edition/has_lead_organisation_test.rb rename to lib/engines/content_block_manager/test/unit/app/models/content_block_edition/has_lead_organisation_test.rb index df03ce4cd06..75ab4d5be82 100644 --- a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/has_lead_organisation_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/has_lead_organisation_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::HasLeadOrganisationTest < ActiveSupport::TestCase +class ContentBlockManager::HasLeadOrganisationTest < ActiveSupport::TestCase extend Minitest::Spec::DSL setup do diff --git a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/validates_details_test.rb b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/validates_details_test.rb similarity index 80% rename from lib/engines/content_object_store/test/unit/app/models/content_block_edition/validates_details_test.rb rename to lib/engines/content_block_manager/test/unit/app/models/content_block_edition/validates_details_test.rb index a1ac28ae623..7bbe1ad899e 100644 --- a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/validates_details_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/validates_details_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::ValidatesDetailsTest < ActiveSupport::TestCase +class ContentBlockManager::ValidatesDetailsTest < ActiveSupport::TestCase extend Minitest::Spec::DSL describe "schema" do @@ -11,7 +11,7 @@ class ContentObjectStore::ValidatesDetailsTest < ActiveSupport::TestCase content_block_schema_mock = Minitest::Mock.new content_block_schema_mock.expect :call, schema, [content_block_edition.block_type] - ContentObjectStore::ContentBlock::Schema.stub :find_by_block_type, content_block_schema_mock do + ContentBlockManager::ContentBlock::Schema.stub :find_by_block_type, content_block_schema_mock do assert_equal content_block_edition.schema, schema end @@ -35,7 +35,7 @@ class ContentObjectStore::ValidatesDetailsTest < ActiveSupport::TestCase describe "human_attribute_name" do it "returns the human readable label for a field prefixed with `details_`" do - assert_equal ContentObjectStore::ContentBlock::Edition.human_attribute_name("details_foo"), "Foo" + assert_equal ContentBlockManager::ContentBlock::Edition.human_attribute_name("details_foo"), "Foo" end end end diff --git a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/workflow_test.rb b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/workflow_test.rb similarity index 95% rename from lib/engines/content_object_store/test/unit/app/models/content_block_edition/workflow_test.rb rename to lib/engines/content_block_manager/test/unit/app/models/content_block_edition/workflow_test.rb index 5c5e46591a8..5fb0ba37bf7 100644 --- a/lib/engines/content_object_store/test/unit/app/models/content_block_edition/workflow_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition/workflow_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::WorkflowTest < ActiveSupport::TestCase +class ContentBlockManager::WorkflowTest < ActiveSupport::TestCase test "draft is the default state" do edition = create(:content_block_edition, document: create(:content_block_document, block_type: "email_address")) assert edition.draft? diff --git a/lib/engines/content_object_store/test/unit/app/models/content_block_edition_test.rb b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition_test.rb similarity index 93% rename from lib/engines/content_object_store/test/unit/app/models/content_block_edition_test.rb rename to lib/engines/content_block_manager/test/unit/app/models/content_block_edition_test.rb index 07306c2777c..f99d41c018a 100644 --- a/lib/engines/content_object_store/test/unit/app/models/content_block_edition_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/models/content_block_edition_test.rb @@ -1,9 +1,9 @@ require "test_helper" -class ContentObjectStore::ContentBlockEditionTest < ActiveSupport::TestCase +class ContentBlockManager::ContentBlockEditionTest < ActiveSupport::TestCase setup do @new_content_id = SecureRandom.uuid - ContentObjectStore::ContentBlock::Edition.any_instance.stubs(:create_random_id).returns(@new_content_id) + ContentBlockManager::ContentBlock::Edition.any_instance.stubs(:create_random_id).returns(@new_content_id) @created_at = Time.zone.local(2000, 12, 31, 23, 59, 59).utc @updated_at = Time.zone.local(2000, 12, 31, 23, 59, 59).utc @@ -12,7 +12,7 @@ class ContentObjectStore::ContentBlockEditionTest < ActiveSupport::TestCase @creator = create(:user) @organisation = create(:organisation) - @content_block_edition = ContentObjectStore::ContentBlock::Edition.new( + @content_block_edition = ContentBlockManager::ContentBlock::Edition.new( created_at: @created_at, updated_at: @updated_at, details: @details, diff --git a/lib/engines/content_object_store/test/unit/app/models/content_block_schema_test.rb b/lib/engines/content_block_manager/test/unit/app/models/content_block_schema_test.rb similarity index 72% rename from lib/engines/content_object_store/test/unit/app/models/content_block_schema_test.rb rename to lib/engines/content_block_manager/test/unit/app/models/content_block_schema_test.rb index 3435552b802..05cf4fa4746 100644 --- a/lib/engines/content_object_store/test/unit/app/models/content_block_schema_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/models/content_block_schema_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::SchemaTest < ActiveSupport::TestCase +class ContentBlockManager::SchemaTest < ActiveSupport::TestCase extend Minitest::Spec::DSL let(:body) { { "properties" => { "foo" => {}, "bar" => {} } } } @@ -24,7 +24,7 @@ class ContentObjectStore::SchemaTest < ActiveSupport::TestCase describe ".valid_schemas" do test "it returns the contents of the VALID_SCHEMA constant" do - assert_equal ContentObjectStore::ContentBlock::Schema.valid_schemas, %w[ + assert_equal ContentBlockManager::ContentBlock::Schema.valid_schemas, %w[ email_address postal_address ] @@ -67,12 +67,12 @@ class ContentObjectStore::SchemaTest < ActiveSupport::TestCase before(:all) do Services.publishing_api.expects(:get_schemas).once.returns(response) - ContentObjectStore::ContentBlock::Schema.stubs(:is_valid_schema?).with(anything).returns(false) - ContentObjectStore::ContentBlock::Schema.stubs(:is_valid_schema?).with(any_of("content_block_foo", "content_block_bar")).returns(true) + ContentBlockManager::ContentBlock::Schema.stubs(:is_valid_schema?).with(anything).returns(false) + ContentBlockManager::ContentBlock::Schema.stubs(:is_valid_schema?).with(any_of("content_block_foo", "content_block_bar")).returns(true) end it "returns a list of schemas with the content block prefix" do - schemas = ContentObjectStore::ContentBlock::Schema.all + schemas = ContentBlockManager::ContentBlock::Schema.all assert_equal schemas.map(&:id), %w[content_block_foo content_block_bar] assert_equal schemas.map(&:fields), [%w[foo_field], %w[bar_field bar_field2]] end @@ -82,7 +82,7 @@ class ContentObjectStore::SchemaTest < ActiveSupport::TestCase # given that we only expect Publishing API to be called once, let's # call our service method twice and assert that no errors were raised assert_nothing_raised do - 2.times { ContentObjectStore::ContentBlock::Schema.all } + 2.times { ContentBlockManager::ContentBlock::Schema.all } end end end @@ -101,14 +101,14 @@ class ContentObjectStore::SchemaTest < ActiveSupport::TestCase end setup do - ContentObjectStore::ContentBlock::Schema.stubs(:all).returns([ + ContentBlockManager::ContentBlock::Schema.stubs(:all).returns([ build(:content_block_schema, block_type:, body:), build(:content_block_schema, block_type: "something_else", body: {}), ]) end test "it returns the schema when the block_type is valid" do - schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(block_type) + schema = ContentBlockManager::ContentBlock::Schema.find_by_block_type(block_type) assert_equal schema.id, "content_block_#{block_type}" assert_equal schema.block_type, block_type @@ -119,27 +119,27 @@ class ContentObjectStore::SchemaTest < ActiveSupport::TestCase block_type = "other_thing" assert_raises ArgumentError, "Cannot find schema for #{block_type}" do - ContentObjectStore::ContentBlock::Schema.find_by_block_type(block_type) + ContentBlockManager::ContentBlock::Schema.find_by_block_type(block_type) end end end describe ".is_valid_schema?" do test "returns true when the schema has correct prefix/suffix" do - ContentObjectStore::ContentBlock::Schema.valid_schemas.each do |schema| - schema_name = "#{ContentObjectStore::ContentBlock::Schema::SCHEMA_PREFIX}_#{schema}" - assert ContentObjectStore::ContentBlock::Schema.is_valid_schema?(schema_name) + ContentBlockManager::ContentBlock::Schema.valid_schemas.each do |schema| + schema_name = "#{ContentBlockManager::ContentBlock::Schema::SCHEMA_PREFIX}_#{schema}" + assert ContentBlockManager::ContentBlock::Schema.is_valid_schema?(schema_name) end end test "returns false when given an invalid schema" do schema_name = "something_else" - assert_equal ContentObjectStore::ContentBlock::Schema.is_valid_schema?(schema_name), false + assert_equal ContentBlockManager::ContentBlock::Schema.is_valid_schema?(schema_name), false end test "returns false when the schema has correct prefix but a suffix that is not valid" do - schema_name = "#{ContentObjectStore::ContentBlock::Schema::SCHEMA_PREFIX}_something" - assert_equal ContentObjectStore::ContentBlock::Schema.is_valid_schema?(schema_name), false + schema_name = "#{ContentBlockManager::ContentBlock::Schema::SCHEMA_PREFIX}_something" + assert_equal ContentBlockManager::ContentBlock::Schema.is_valid_schema?(schema_name), false end end end diff --git a/lib/engines/content_object_store/test/unit/app/services/create_edition_service_test.rb b/lib/engines/content_block_manager/test/unit/app/services/create_edition_service_test.rb similarity index 72% rename from lib/engines/content_object_store/test/unit/app/services/create_edition_service_test.rb rename to lib/engines/content_block_manager/test/unit/app/services/create_edition_service_test.rb index b515c1a9dd1..cbdcfd46b2e 100644 --- a/lib/engines/content_object_store/test/unit/app/services/create_edition_service_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/services/create_edition_service_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::CreateEditionServiceTest < ActiveSupport::TestCase +class ContentBlockManager::CreateEditionServiceTest < ActiveSupport::TestCase extend Minitest::Spec::DSL describe "#call" do @@ -27,26 +27,26 @@ class ContentObjectStore::CreateEditionServiceTest < ActiveSupport::TestCase setup do # This UUID is created by the database so instead of loading the record # we stub the initial creation so we know what UUID to check for. - ContentObjectStore::ContentBlock::Edition.any_instance.stubs(:create_random_id) + ContentBlockManager::ContentBlock::Edition.any_instance.stubs(:create_random_id) .returns(content_id) - ContentObjectStore::ContentBlock::Schema.stubs(:find_by_block_type) + ContentBlockManager::ContentBlock::Schema.stubs(:find_by_block_type) .returns(schema) end it "returns a ContentBlockEdition" do - result = ContentObjectStore::CreateEditionService.new(schema).call(edition_params) - assert_instance_of ContentObjectStore::ContentBlock::Edition, result + result = ContentBlockManager::CreateEditionService.new(schema).call(edition_params) + assert_instance_of ContentBlockManager::ContentBlock::Edition, result end it "creates a ContentBlockEdition in Whitehall" do - assert_changes -> { ContentObjectStore::ContentBlock::Document.count }, from: 0, to: 1 do - assert_changes -> { ContentObjectStore::ContentBlock::Edition.count }, from: 0, to: 1 do - ContentObjectStore::CreateEditionService.new(schema).call(edition_params) + assert_changes -> { ContentBlockManager::ContentBlock::Document.count }, from: 0, to: 1 do + assert_changes -> { ContentBlockManager::ContentBlock::Edition.count }, from: 0, to: 1 do + ContentBlockManager::CreateEditionService.new(schema).call(edition_params) end end - new_document = ContentObjectStore::ContentBlock::Document.find_by!(content_id:) + new_document = ContentBlockManager::ContentBlock::Document.find_by!(content_id:) new_edition = new_document.editions.first assert_equal new_title, new_document.title @@ -58,7 +58,7 @@ class ContentObjectStore::CreateEditionServiceTest < ActiveSupport::TestCase it "sends the content block to the Publishing API as a draft" do assert_draft_created_in_publishing_api(content_id) do - ContentObjectStore::CreateEditionService.new(schema).call(edition_params) + ContentBlockManager::CreateEditionService.new(schema).call(edition_params) end end @@ -67,9 +67,9 @@ class ContentObjectStore::CreateEditionServiceTest < ActiveSupport::TestCase let!(:previous_edition) { create(:content_block_edition, :email_address, document:) } it "creates a new edition for that document" do - assert_no_changes -> { ContentObjectStore::ContentBlock::Document.count } do + assert_no_changes -> { ContentBlockManager::ContentBlock::Document.count } do assert_changes -> { document.reload.editions.count }, from: 1, to: 2 do - ContentObjectStore::CreateEditionService.new(schema).call(edition_params, document_id: document.id) + ContentBlockManager::CreateEditionService.new(schema).call(edition_params, document_id: document.id) end end @@ -83,7 +83,7 @@ class ContentObjectStore::CreateEditionServiceTest < ActiveSupport::TestCase it "sends the content block to the Publishing API as a draft" do assert_draft_created_in_publishing_api(document.content_id) do - ContentObjectStore::CreateEditionService.new(schema).call(edition_params, document_id: document.id) + ContentBlockManager::CreateEditionService.new(schema).call(edition_params, document_id: document.id) end end end diff --git a/lib/engines/content_object_store/test/unit/app/services/get_host_content_items_test.rb b/lib/engines/content_block_manager/test/unit/app/services/get_host_content_items_test.rb similarity index 95% rename from lib/engines/content_object_store/test/unit/app/services/get_host_content_items_test.rb rename to lib/engines/content_block_manager/test/unit/app/services/get_host_content_items_test.rb index 93513bebf3d..8e4c428ff9c 100644 --- a/lib/engines/content_object_store/test/unit/app/services/get_host_content_items_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/services/get_host_content_items_test.rb @@ -1,9 +1,9 @@ require "test_helper" -class ContentObjectStore::GetHostContentItemsTest < ActiveSupport::TestCase +class ContentBlockManager::GetHostContentItemsTest < ActiveSupport::TestCase extend Minitest::Spec::DSL - let(:described_class) { ContentObjectStore::GetHostContentItems } + let(:described_class) { ContentBlockManager::GetHostContentItems } let(:target_content_id) { SecureRandom.uuid } diff --git a/lib/engines/content_object_store/test/unit/app/services/publish_edition_service_test.rb b/lib/engines/content_block_manager/test/unit/app/services/publish_edition_service_test.rb similarity index 82% rename from lib/engines/content_object_store/test/unit/app/services/publish_edition_service_test.rb rename to lib/engines/content_block_manager/test/unit/app/services/publish_edition_service_test.rb index 28272585b34..6f1ea986be1 100644 --- a/lib/engines/content_object_store/test/unit/app/services/publish_edition_service_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/services/publish_edition_service_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::PublishEditionServiceTest < ActiveSupport::TestCase +class ContentBlockManager::PublishEditionServiceTest < ActiveSupport::TestCase extend Minitest::Spec::DSL describe "#call" do @@ -10,18 +10,18 @@ class ContentObjectStore::PublishEditionServiceTest < ActiveSupport::TestCase let(:edition) { create(:content_block_edition, document:, details: { "foo" => "Foo text", "bar" => "Bar text" }, organisation: @organisation) } setup do - ContentObjectStore::ContentBlock::Schema.stubs(:find_by_block_type) + ContentBlockManager::ContentBlock::Schema.stubs(:find_by_block_type) .returns(schema) @organisation = create(:organisation) end test "returns a ContentBlockEdition" do - result = ContentObjectStore::PublishEditionService.new(schema).call(edition) - assert_instance_of ContentObjectStore::ContentBlock::Edition, result + result = ContentBlockManager::PublishEditionService.new(schema).call(edition) + assert_instance_of ContentBlockManager::ContentBlock::Edition, result end test "it publishes the Edition in Whitehall" do - ContentObjectStore::PublishEditionService.new(schema).call(edition) + ContentBlockManager::PublishEditionService.new(schema).call(edition) assert_equal "published", edition.state assert_equal edition.id, document.live_edition_id @@ -58,7 +58,7 @@ class ContentObjectStore::PublishEditionServiceTest < ActiveSupport::TestCase ] Services.stub :publishing_api, publishing_api_mock do - ContentObjectStore::PublishEditionService.new(schema).call(edition) + ContentBlockManager::PublishEditionService.new(schema).call(edition) publishing_api_mock.verify assert_equal "published", edition.state @@ -79,7 +79,7 @@ class ContentObjectStore::PublishEditionServiceTest < ActiveSupport::TestCase Services.publishing_api.stub :put_content, raises_exception do assert_raises(GdsApi::HTTPErrorResponse) do - ContentObjectStore::PublishEditionService.new(schema).call(edition) + ContentBlockManager::PublishEditionService.new(schema).call(edition) end assert_equal "draft", edition.state assert_nil document.live_edition_id @@ -111,8 +111,8 @@ class ContentObjectStore::PublishEditionServiceTest < ActiveSupport::TestCase raises_exception = ->(*_args) { raise exception } Services.publishing_api.stub :publish, raises_exception do - assert_raises(ContentObjectStore::PublishEditionService::PublishingFailureError, "Could not publish #{content_id} because: Some backend error") do - ContentObjectStore::PublishEditionService.new(schema).call(edition) + assert_raises(ContentBlockManager::PublishEditionService::PublishingFailureError, "Could not publish #{content_id} because: Some backend error") do + ContentBlockManager::PublishEditionService.new(schema).call(edition) publishing_api_mock.verify end assert_equal "draft", edition.state diff --git a/lib/engines/content_object_store/test/unit/app/services/schedule_edition_service_test.rb b/lib/engines/content_block_manager/test/unit/app/services/schedule_edition_service_test.rb similarity index 84% rename from lib/engines/content_object_store/test/unit/app/services/schedule_edition_service_test.rb rename to lib/engines/content_block_manager/test/unit/app/services/schedule_edition_service_test.rb index 12363077b30..4f7021fe8db 100644 --- a/lib/engines/content_object_store/test/unit/app/services/schedule_edition_service_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/services/schedule_edition_service_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::ScheduleEditionServiceTest < ActiveSupport::TestCase +class ContentBlockManager::ScheduleEditionServiceTest < ActiveSupport::TestCase extend Minitest::Spec::DSL let(:content_id) { SecureRandom.uuid } @@ -30,7 +30,7 @@ class ContentObjectStore::ScheduleEditionServiceTest < ActiveSupport::TestCase end it "schedules a new Edition via the Content Block Worker" do - ContentObjectStore::SchedulePublishingWorker.expects(:queue).with do |expected_edition| + ContentBlockManager::SchedulePublishingWorker.expects(:queue).with do |expected_edition| expected_edition.id = edition.id && expected_edition.scheduled_publication.year == scheduled_publication_params[:"scheduled_publication(1i)"].to_i && expected_edition.scheduled_publication.month == scheduled_publication_params[:"scheduled_publication(2i)"].to_i && @@ -40,7 +40,7 @@ class ContentObjectStore::ScheduleEditionServiceTest < ActiveSupport::TestCase expected_edition.scheduled? end - updated_edition = ContentObjectStore::ScheduleEditionService + updated_edition = ContentBlockManager::ScheduleEditionService .new(schema) .call(edition, scheduled_publication_params) @@ -55,9 +55,9 @@ class ContentObjectStore::ScheduleEditionServiceTest < ActiveSupport::TestCase ) raises_exception = ->(*_args) { raise exception } - ContentObjectStore::SchedulePublishingWorker.stub :queue, raises_exception do + ContentBlockManager::SchedulePublishingWorker.stub :queue, raises_exception do assert_raises(GdsApi::HTTPErrorResponse) do - updated_edition = ContentObjectStore::ScheduleEditionService + updated_edition = ContentBlockManager::ScheduleEditionService .new(schema) .call(edition, scheduled_publication_params) @@ -71,11 +71,11 @@ class ContentObjectStore::ScheduleEditionServiceTest < ActiveSupport::TestCase exception = ArgumentError.new("Cannot find schema for block_type") raises_exception = ->(*_args) { raise exception } - ContentObjectStore::SchedulePublishingWorker.expects(:queue).never + ContentBlockManager::SchedulePublishingWorker.expects(:queue).never edition.stub :update!, raises_exception do assert_raises(ArgumentError) do - ContentObjectStore::ScheduleEditionService + ContentBlockManager::ScheduleEditionService .new(schema) .call(edition, scheduled_publication_params) end @@ -101,13 +101,13 @@ class ContentObjectStore::ScheduleEditionServiceTest < ActiveSupport::TestCase stub_publishing_api_has_embedded_content(content_id:, total: 0, results: dependent_content) - ContentObjectStore::PublishIntentWorker.expects(:perform_async).with( + ContentBlockManager::PublishIntentWorker.expects(:perform_async).with( "/host-document", "example-app", Time.zone.local(2034, 9, 2, 10, 5, 0).to_s, ).once - ContentObjectStore::ScheduleEditionService + ContentBlockManager::ScheduleEditionService .new(schema) .call(edition, scheduled_publication_params) end diff --git a/lib/engines/content_object_store/test/unit/app/validators/details_validator_test.rb b/lib/engines/content_block_manager/test/unit/app/validators/details_validator_test.rb similarity index 95% rename from lib/engines/content_object_store/test/unit/app/validators/details_validator_test.rb rename to lib/engines/content_block_manager/test/unit/app/validators/details_validator_test.rb index be0a6d1dbdb..e9943ad3d37 100644 --- a/lib/engines/content_object_store/test/unit/app/validators/details_validator_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/validators/details_validator_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::DetailsValidatorTest < ActiveSupport::TestCase +class ContentBlockManager::DetailsValidatorTest < ActiveSupport::TestCase extend Minitest::Spec::DSL let(:body) do diff --git a/lib/engines/content_object_store/test/unit/app/validators/organisation_validator_test.rb b/lib/engines/content_block_manager/test/unit/app/validators/organisation_validator_test.rb similarity index 81% rename from lib/engines/content_object_store/test/unit/app/validators/organisation_validator_test.rb rename to lib/engines/content_block_manager/test/unit/app/validators/organisation_validator_test.rb index 79806cf4cb6..5c779cddf7b 100644 --- a/lib/engines/content_object_store/test/unit/app/validators/organisation_validator_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/validators/organisation_validator_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::OrganisationValidatorTest < ActiveSupport::TestCase +class ContentBlockManager::OrganisationValidatorTest < ActiveSupport::TestCase extend Minitest::Spec::DSL test "it validates presence of a lead organisation" do diff --git a/lib/engines/content_object_store/test/unit/app/workers/publish_intent_worker_test.rb b/lib/engines/content_block_manager/test/unit/app/workers/publish_intent_worker_test.rb similarity index 72% rename from lib/engines/content_object_store/test/unit/app/workers/publish_intent_worker_test.rb rename to lib/engines/content_block_manager/test/unit/app/workers/publish_intent_worker_test.rb index 4e83af34e62..8908ffe68f4 100644 --- a/lib/engines/content_object_store/test/unit/app/workers/publish_intent_worker_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/workers/publish_intent_worker_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::PublishIntentWorkerTest < ActiveSupport::TestCase +class ContentBlockManager::PublishIntentWorkerTest < ActiveSupport::TestCase test "#perform adds a publishing intent to the Publishing API" do base_path = "/base-path" timestamp = Time.zone.now.to_s @@ -9,6 +9,6 @@ class ContentObjectStore::PublishIntentWorkerTest < ActiveSupport::TestCase PublishingApi::PublishIntentPresenter.expects(:new).with(base_path, timestamp, publishing_app).once.returns(publish_intent) Services.publishing_api.expects(:put_intent).once.with(base_path, publish_intent.as_json) - ContentObjectStore::PublishIntentWorker.new.perform(base_path, publishing_app, timestamp) + ContentBlockManager::PublishIntentWorker.new.perform(base_path, publishing_app, timestamp) end end diff --git a/lib/engines/content_object_store/test/unit/app/workers/schedule_publishing_worker_test.rb b/lib/engines/content_block_manager/test/unit/app/workers/schedule_publishing_worker_test.rb similarity index 61% rename from lib/engines/content_object_store/test/unit/app/workers/schedule_publishing_worker_test.rb rename to lib/engines/content_block_manager/test/unit/app/workers/schedule_publishing_worker_test.rb index d530b264fad..2be82481526 100644 --- a/lib/engines/content_object_store/test/unit/app/workers/schedule_publishing_worker_test.rb +++ b/lib/engines/content_block_manager/test/unit/app/workers/schedule_publishing_worker_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase +class ContentBlockManager::SchedulePublishingWorkerTest < ActiveSupport::TestCase include SidekiqTestHelpers # Suppress noisy Sidekiq logging in the test output @@ -15,12 +15,12 @@ class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase document = create(:content_block_document, :email_address) edition = create(:content_block_edition, document:, state: "scheduled", scheduled_publication: Time.zone.now) - ContentObjectStore::ContentBlock::Schema.expects(:find_by_block_type).with("email_address").returns(schema) + ContentBlockManager::ContentBlock::Schema.expects(:find_by_block_type).with("email_address").returns(schema) publish_service_mock = Minitest::Mock.new - ContentObjectStore::PublishEditionService.expects(:new).with(schema).returns(publish_service_mock) + ContentBlockManager::PublishEditionService.expects(:new).with(schema).returns(publish_service_mock) publish_service_mock.expect :call, nil, [edition] - ContentObjectStore::SchedulePublishingWorker.new.perform(edition.id) + ContentBlockManager::SchedulePublishingWorker.new.perform(edition.id) publish_service_mock.verify end @@ -30,17 +30,17 @@ class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase document = create(:content_block_document, :email_address) edition = create(:content_block_edition, document:, state: "scheduled", scheduled_publication: 7.days.since(Time.zone.now).to_date) - ContentObjectStore::ContentBlock::Schema.expects(:find_by_block_type).with("email_address").returns(schema) + ContentBlockManager::ContentBlock::Schema.expects(:find_by_block_type).with("email_address").returns(schema) publish_service_mock = Minitest::Mock.new - exception = ContentObjectStore::PublishEditionService::PublishingFailureError.new( + exception = ContentBlockManager::PublishEditionService::PublishingFailureError.new( "Could not publish #{document.content_id} because: Some backend error", ) - ContentObjectStore::PublishEditionService.any_instance.stubs(:call).raises(exception) + ContentBlockManager::PublishEditionService.any_instance.stubs(:call).raises(exception) - assert_raises(ContentObjectStore::SchedulePublishingWorker::SchedulingFailure, "Could not publish #{document.content_id} because: Some backend error") do - ContentObjectStore::SchedulePublishingWorker.new.perform(edition.id) + assert_raises(ContentBlockManager::SchedulePublishingWorker::SchedulingFailure, "Could not publish #{document.content_id} because: Some backend error") do + ContentBlockManager::SchedulePublishingWorker.new.perform(edition.id) end publish_service_mock.verify end @@ -49,11 +49,11 @@ class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase document = create(:content_block_document, :email_address) edition = create(:content_block_edition, document:, state: "published") - ContentObjectStore::ContentBlock::Schema.expects(:find_by_block_type).never - ContentObjectStore::PublishEditionService.expects(:new).never - ContentObjectStore::PublishEditionService.any_instance.expects(:call).never + ContentBlockManager::ContentBlock::Schema.expects(:find_by_block_type).never + ContentBlockManager::PublishEditionService.expects(:new).never + ContentBlockManager::PublishEditionService.any_instance.expects(:call).never - ContentObjectStore::SchedulePublishingWorker.new.perform(edition.id) + ContentBlockManager::SchedulePublishingWorker.new.perform(edition.id) end test ".queue queues a job for a scheduled edition" do @@ -64,9 +64,9 @@ class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase scheduled_publication: 1.day.from_now ) - ContentObjectStore::SchedulePublishingWorker.queue(edition) + ContentBlockManager::SchedulePublishingWorker.queue(edition) - assert job = ContentObjectStore::SchedulePublishingWorker.jobs.last + assert job = ContentBlockManager::SchedulePublishingWorker.jobs.last assert_equal edition.id, job["args"].first assert_equal edition.scheduled_publication.to_i, job["at"].to_i end @@ -89,12 +89,12 @@ class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase ) with_real_sidekiq do - ContentObjectStore::SchedulePublishingWorker.queue(edition) - ContentObjectStore::SchedulePublishingWorker.queue(control_edition) + ContentBlockManager::SchedulePublishingWorker.queue(edition) + ContentBlockManager::SchedulePublishingWorker.queue(control_edition) assert_equal 2, Sidekiq::ScheduledSet.new.size - ContentObjectStore::SchedulePublishingWorker.dequeue(edition) + ContentBlockManager::SchedulePublishingWorker.dequeue(edition) assert_equal 1, Sidekiq::ScheduledSet.new.size @@ -123,12 +123,12 @@ class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase ) with_real_sidekiq do - ContentObjectStore::SchedulePublishingWorker.queue(edition_1) - ContentObjectStore::SchedulePublishingWorker.queue(edition_2) + ContentBlockManager::SchedulePublishingWorker.queue(edition_1) + ContentBlockManager::SchedulePublishingWorker.queue(edition_2) assert_equal 2, Sidekiq::ScheduledSet.new.size - ContentObjectStore::SchedulePublishingWorker.dequeue_all + ContentBlockManager::SchedulePublishingWorker.dequeue_all assert_equal 0, Sidekiq::ScheduledSet.new.size end @@ -136,20 +136,20 @@ class ContentObjectStore::SchedulePublishingWorkerTest < ActiveSupport::TestCase test ".queue_size returns the number of queued ContentBlockPublishingWorker jobs" do with_real_sidekiq do - ContentObjectStore::SchedulePublishingWorker.perform_at(1.day.from_now, "null") - assert_equal 1, ContentObjectStore::SchedulePublishingWorker.queue_size + ContentBlockManager::SchedulePublishingWorker.perform_at(1.day.from_now, "null") + assert_equal 1, ContentBlockManager::SchedulePublishingWorker.queue_size - ContentObjectStore::SchedulePublishingWorker.perform_at(2.days.from_now, "null") - assert_equal 2, ContentObjectStore::SchedulePublishingWorker.queue_size + ContentBlockManager::SchedulePublishingWorker.perform_at(2.days.from_now, "null") + assert_equal 2, ContentBlockManager::SchedulePublishingWorker.queue_size end end test ".queued_edition_ids returns the edition ids of the currently queued jobs" do with_real_sidekiq do - ContentObjectStore::SchedulePublishingWorker.perform_at(1.day.from_now, "3") - ContentObjectStore::SchedulePublishingWorker.perform_at(2.days.from_now, "6") + ContentBlockManager::SchedulePublishingWorker.perform_at(1.day.from_now, "3") + ContentBlockManager::SchedulePublishingWorker.perform_at(2.days.from_now, "6") - assert_same_elements %w[3 6], ContentObjectStore::SchedulePublishingWorker.queued_edition_ids + assert_same_elements %w[3 6], ContentBlockManager::SchedulePublishingWorker.queued_edition_ids end end end diff --git a/lib/engines/content_object_store/app/controllers/content_object_store/content_block/documents_controller.rb b/lib/engines/content_object_store/app/controllers/content_object_store/content_block/documents_controller.rb deleted file mode 100644 index 594982c9641..00000000000 --- a/lib/engines/content_object_store/app/controllers/content_object_store/content_block/documents_controller.rb +++ /dev/null @@ -1,26 +0,0 @@ -class ContentObjectStore::ContentBlock::DocumentsController < ContentObjectStore::BaseController - def index - @content_block_documents = ContentObjectStore::ContentBlock::Document.live - end - - def show - @content_block_document = ContentObjectStore::ContentBlock::Document.find(params[:id]) - @content_block_versions = @content_block_document.versions - - @host_content_items = ContentObjectStore::GetHostContentItems.by_embedded_document( - content_block_document: @content_block_document, - ) - end - - def new - @schemas = ContentObjectStore::ContentBlock::Schema.all - end - - def new_document_options_redirect - if params[:block_type].present? - redirect_to content_object_store.new_content_object_store_content_block_edition_path(block_type: params.require(:block_type)) - else - redirect_to content_object_store.new_content_object_store_content_block_document_path, flash: { error: "You must select a block type" } - end - end -end diff --git a/lib/engines/content_object_store/app/controllers/content_object_store/content_block/editions_controller.rb b/lib/engines/content_object_store/app/controllers/content_object_store/content_block/editions_controller.rb deleted file mode 100644 index e224a5ce9b3..00000000000 --- a/lib/engines/content_object_store/app/controllers/content_object_store/content_block/editions_controller.rb +++ /dev/null @@ -1,32 +0,0 @@ -class ContentObjectStore::ContentBlock::EditionsController < ContentObjectStore::BaseController - def new - if params[:document_id] - @content_block_document = ContentObjectStore::ContentBlock::Document.find(params[:document_id]) - @schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(@content_block_document.block_type) - content_block_edition = @content_block_document.latest_edition - else - @schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(params[:block_type].underscore) - content_block_edition = ContentObjectStore::ContentBlock::Edition.new - end - @form = ContentObjectStore::ContentBlock::EditionForm.for( - content_block_edition:, - schema: @schema, - ) - end - - def create - @schema = ContentObjectStore::ContentBlock::Schema.find_by_block_type(block_type_param) - new_edition = ContentObjectStore::CreateEditionService.new(@schema).call(edition_params, document_id: params[:document_id]) - step = params[:document_id] ? ContentObjectStore::ContentBlock::Editions::WorkflowController::UPDATE_BLOCK_STEPS[:review_links] : ContentObjectStore::ContentBlock::Editions::WorkflowController::NEW_BLOCK_STEPS[:review] - redirect_to content_object_store.content_object_store_content_block_workflow_path(id: new_edition.id, step:) - rescue ActiveRecord::RecordInvalid => e - @form = ContentObjectStore::ContentBlock::EditionForm.for(content_block_edition: e.record, schema: @schema) - render "content_object_store/content_block/editions/new" - end - -private - - def block_type_param - params.require("content_block/edition").require("document_attributes").require(:block_type) - end -end diff --git a/lib/engines/content_object_store/config/locales/en.yml b/lib/engines/content_object_store/config/locales/en.yml deleted file mode 100644 index 09a4adc92fe..00000000000 --- a/lib/engines/content_object_store/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -en: - activerecord: - attributes: - content_object_store/content_block/edition/document: - title: Title diff --git a/lib/engines/content_object_store/lib/content_object_store.rb b/lib/engines/content_object_store/lib/content_object_store.rb deleted file mode 100644 index b686bc00f20..00000000000 --- a/lib/engines/content_object_store/lib/content_object_store.rb +++ /dev/null @@ -1,4 +0,0 @@ -require_relative "content_object_store/engine" - -module ContentObjectStore -end diff --git a/lib/engines/content_object_store/test/factories/content_block_edition_organisation.rb b/lib/engines/content_object_store/test/factories/content_block_edition_organisation.rb deleted file mode 100644 index 835b40f1fc1..00000000000 --- a/lib/engines/content_object_store/test/factories/content_block_edition_organisation.rb +++ /dev/null @@ -1,6 +0,0 @@ -FactoryBot.define do - factory :content_block_edition_organisation, class: "ContentObjectStore::ContentBlock::EditionOrganisation" do - edition {} - organisation {} - end -end diff --git a/lib/engines/content_object_store/test/factories/content_block_schema.rb b/lib/engines/content_object_store/test/factories/content_block_schema.rb deleted file mode 100644 index 1e358263b4f..00000000000 --- a/lib/engines/content_object_store/test/factories/content_block_schema.rb +++ /dev/null @@ -1,16 +0,0 @@ -FactoryBot.define do - factory :content_block_schema, class: "ContentObjectStore::ContentBlock::Schema" do - body { {} } - block_type { "block_type" } - - ContentObjectStore::ContentBlock::Schema.valid_schemas.each do |type| - trait type.to_sym do - block_type { type } - end - end - - initialize_with do - new("#{ContentObjectStore::ContentBlock::Schema::SCHEMA_PREFIX}_#{block_type}", body) - end - end -end diff --git a/lib/engines/content_object_store/test/functional/base_controller_test.rb b/lib/engines/content_object_store/test/functional/base_controller_test.rb deleted file mode 100644 index 123870280a3..00000000000 --- a/lib/engines/content_object_store/test/functional/base_controller_test.rb +++ /dev/null @@ -1,5 +0,0 @@ -require "test_helper" - -class ContentObjectStore::BaseControllerTest < ActionController::TestCase - should_be_an_admin_controller -end From 9650960a79c1a78f9f9ca5d4424ccf998a15e25b Mon Sep 17 00:00:00 2001 From: Harriet H-W Date: Wed, 9 Oct 2024 14:18:57 +0100 Subject: [PATCH 2/4] refactor test step to take user to block manager home page --- .../features/content_block_manager.feature | 2 +- .../features/create_object.feature | 12 ++++++------ .../features/edit_object.feature | 8 ++++---- .../features/object_store_feature_flag.feature | 2 +- .../step_definitions/content_block_manager_steps.rb | 4 ++-- .../features/view_object.feature | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/engines/content_block_manager/features/content_block_manager.feature b/lib/engines/content_block_manager/features/content_block_manager.feature index 4205b86e362..b3a0bec3996 100644 --- a/lib/engines/content_block_manager/features/content_block_manager.feature +++ b/lib/engines/content_block_manager/features/content_block_manager.feature @@ -3,6 +3,6 @@ Feature: Content block manager Scenario: Correct layout is used Given the content block manager feature flag is enabled Given I am a GDS admin - When I visit the document object store + When I visit the Content Block Manager home page Then I should see the object store's title in the header And I should see the object store's navigation diff --git a/lib/engines/content_block_manager/features/create_object.feature b/lib/engines/content_block_manager/features/create_object.feature index d458173fb61..e0e9356f7ea 100644 --- a/lib/engines/content_block_manager/features/create_object.feature +++ b/lib/engines/content_block_manager/features/create_object.feature @@ -13,7 +13,7 @@ Feature: Create a content object | rate | string | | true | Scenario: GDS editor creates an object - When I visit the document object store + When I visit the Content Block Manager home page And I click to create an object Then I should see all the schemas listed And I should see a back link to the document list page @@ -29,20 +29,20 @@ Feature: Create a content object And I should be taken back to the document page Scenario: GDS editor sees validation errors when not selecting an object type - When I visit the document object store + When I visit the Content Block Manager home page And I click to create an object And I click save Then I should see an error prompting me to choose an object type Scenario: GDS editor sees validation errors for missing fields - When I visit the document object store + When I visit the Content Block Manager home page And I click to create an object When I click on the "email_address" schema And I click save Then I should see errors for the required fields Scenario: GDS editor sees validation errors for invalid fields - When I visit the document object store + When I visit the Content Block Manager home page And I click to create an object Then I should see all the schemas listed When I click on the "email_address" schema @@ -53,12 +53,12 @@ Feature: Create a content object Then I should see a message that the "email_address" field is an invalid "email" Scenario: Draft documents are not listed - When I visit the document object store + When I visit the Content Block Manager home page And I click to create an object When I click on the "email_address" schema Then I should see a form for the schema When I complete the form with the following fields: | title | email_address | department | organisation | | my email address | foo@example.com | Somewhere | Ministry of Example | - And I visit the document object store + And I visit the Content Block Manager home page Then I should not see the draft document diff --git a/lib/engines/content_block_manager/features/edit_object.feature b/lib/engines/content_block_manager/features/edit_object.feature index 68ad3f8d303..3386999c715 100644 --- a/lib/engines/content_block_manager/features/edit_object.feature +++ b/lib/engines/content_block_manager/features/edit_object.feature @@ -10,7 +10,7 @@ Feature: Edit a content object And dependent content exists for a content block Scenario: GDS Editor edits a content object - When I visit the document object store + When I visit the Content Block Manager home page Then I should see the details for all documents When I click to view the document Then I should see the details for the email address content block @@ -34,7 +34,7 @@ Feature: Edit a content object | field | type | format | required | | email_address | string | email | true | And an email address content block has been created - When I visit the document object store + When I visit the Content Block Manager home page When I click to view the document When I click the first change link And I set all fields to blank @@ -45,7 +45,7 @@ Feature: Edit a content object | field | type | format | required | | email_address | string | email | true | And an email address content block has been created - When I visit the document object store + When I visit the Content Block Manager home page When I click to view the document When I click the first change link When I complete the form with the following fields: @@ -66,6 +66,6 @@ Feature: Edit a content object Scenario: GDS editor still sees live edition when abandoning an edit When I am updating a content block - And I visit the document object store + And I visit the Content Block Manager home page Then I should still see the live edition on the homepage diff --git a/lib/engines/content_block_manager/features/object_store_feature_flag.feature b/lib/engines/content_block_manager/features/object_store_feature_flag.feature index 3841b4df0d2..d3f6049dddb 100644 --- a/lib/engines/content_block_manager/features/object_store_feature_flag.feature +++ b/lib/engines/content_block_manager/features/object_store_feature_flag.feature @@ -5,5 +5,5 @@ Feature: Create a content object when feature flag is disabled Given I am a GDS admin Scenario: GDS editor visits object store - When I visit the document object store + When I visit the Content Block Manager home page Then I should see a permissions error diff --git a/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb b/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb index 474784f30c5..966d5e28c91 100644 --- a/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb +++ b/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb @@ -155,8 +155,8 @@ visit content_block_manager.content_block_manager_content_block_edition_path(@content_block) end -When("I visit the document object store") do - visit content_block_manager.content_block_manager_content_block_documents_path +When("I visit the Content Block Manager home page") do + visit content_block_manager.content_block_manager_root_path end Then("I should see the details for all documents") do diff --git a/lib/engines/content_block_manager/features/view_object.feature b/lib/engines/content_block_manager/features/view_object.feature index 3567d9aac42..40480fff553 100644 --- a/lib/engines/content_block_manager/features/view_object.feature +++ b/lib/engines/content_block_manager/features/view_object.feature @@ -8,7 +8,7 @@ Feature: View a content object And an email address content block has been created Scenario: GDS Editor views a content object - When I visit the document object store + When I visit the Content Block Manager home page Then I should see the details for all documents When I click to view the document Then I should be taken back to the document page @@ -17,7 +17,7 @@ Feature: View a content object Scenario: GDS Editor views dependent Content Given dependent content exists for a content block - When I visit the document object store + When I visit the Content Block Manager home page And I click to view the document Then I should see the dependent content listed From 8260e14b5bb653f7f215b9aa3b99dbf35b496319 Mon Sep 17 00:00:00 2001 From: Harriet H-W Date: Wed, 9 Oct 2024 14:27:00 +0100 Subject: [PATCH 3/4] remove `government/admin` from block manager url this is not relevant to the Content Block Manager, so we are just having the endpoint be `/content-block-manager`. --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index b1ecc1398ee..6694a41e933 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -459,5 +459,5 @@ def redirect(path, options = { prefix: Whitehall.router_prefix }) mount GovukPublishingComponents::Engine, at: "/component-guide" unless Rails.env.production? - mount ContentBlockManager::Engine, at: "government/admin/content-block-manager", as: "content_block_manager" + mount ContentBlockManager::Engine, at: "content-block-manager", as: "content_block_manager" end From f3e4b3040e1126983badbcf33ca41eff4794d1d5 Mon Sep 17 00:00:00 2001 From: Harriet H-W Date: Thu, 10 Oct 2024 10:02:52 +0100 Subject: [PATCH 4/4] correct name of ContentBlockManager engine in migration although it is not good practice to edit past migrations, we think this is safe to do as it doesn't change the actual migration, and not changing it could cause problems/confusion in the future. --- ...4121_add_latest_edition_info_to_content_block_documents.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20240725144121_add_latest_edition_info_to_content_block_documents.rb b/db/migrate/20240725144121_add_latest_edition_info_to_content_block_documents.rb index 32d861a8360..0f140e79170 100644 --- a/db/migrate/20240725144121_add_latest_edition_info_to_content_block_documents.rb +++ b/db/migrate/20240725144121_add_latest_edition_info_to_content_block_documents.rb @@ -1,6 +1,6 @@ class AddLatestEditionInfoToContentBlockDocuments < ActiveRecord::Migration[7.1] def up - ContentObjectStore::ContentBlock::Document.find_each do |document| + ContentBlockManager::ContentBlock::Document.find_each do |document| if document.latest_edition_id.nil? || document.live_edition_id.nil? document.update!( latest_edition_id: document.content_block_editions.last.id, @@ -11,7 +11,7 @@ def up end def down - ContentObjectStore::ContentBlock::Document.update_all( + ContentBlockManager::ContentBlock::Document.update_all( latest_edition_id: nil, live_edition_id: nil, )