diff --git a/Gemfile b/Gemfile index 052c540f4..1c84de83b 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem 'gds-sso', '~> 11.2' gem 'gds-api-adapters', '~> 41.0.0' gem 'govspeak', '~> 3.4.0' gem 'govuk_admin_template', '4.2.0' -gem "govuk_content_models", '44.0.0' +gem "govuk_content_models", '44.0.1' gem 'govuk_sidekiq', '0.0.4' gem 'has_scope' gem 'inherited_resources' diff --git a/Gemfile.lock b/Gemfile.lock index 27bfb32b1..59a1c9636 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -137,7 +137,7 @@ GEM bootstrap-sass (= 3.3.5.1) jquery-rails (~> 3.1.3) rails (>= 3.2.0) - govuk_content_models (44.0.0) + govuk_content_models (44.0.1) bson_ext gds-api-adapters (>= 10.9.0) gds-sso (~> 11.2) @@ -460,7 +460,7 @@ DEPENDENCIES govuk-content-schema-test-helpers (~> 1.4) govuk-lint (~> 0.7) govuk_admin_template (= 4.2.0) - govuk_content_models (= 44.0.0) + govuk_content_models (= 44.0.1) govuk_sidekiq (= 0.0.4) has_scope inherited_resources diff --git a/test/integration/add_artefact_test.rb b/test/integration/add_artefact_test.rb index 203b623ba..e77a76cee 100644 --- a/test/integration/add_artefact_test.rb +++ b/test/integration/add_artefact_test.rb @@ -36,4 +36,17 @@ class AddArtefactTest < ActionDispatch::IntegrationTest options = find_field("Format").find_all('option').map(&:value) assert_empty options & Artefact::RETIRED_FORMATS end + + should "not allow creation of a done page without the /done prefix" do + visit root_path + click_link "Add artefact" + + fill_in "Title", with: "Done thing" + fill_in "Slug", with: "done-thing" + select "Completed transaction", from: "Format" + + click_button "Save and go to item" + + assert page.has_content?("Done page slugs must have a done/ prefix") + end end diff --git a/test/integration/change_edition_type_test.rb b/test/integration/change_edition_type_test.rb index f44788fa2..05ebffbca 100644 --- a/test/integration/change_edition_type_test.rb +++ b/test/integration/change_edition_type_test.rb @@ -25,6 +25,8 @@ def edition_parts(edition) def create_artefact_of_kind(kind) if kind == 'help_page' FactoryGirl.create(:artefact, slug: "help/foo", kind: kind) + elsif kind == 'completed_transaction' + FactoryGirl.create(:artefact, slug: "done/foo", kind: kind) else FactoryGirl.create(:artefact, kind: kind) end diff --git a/test/unit/presenters/formats/completed_transaction_presenter_test.rb b/test/unit/presenters/formats/completed_transaction_presenter_test.rb index ae218da93..0188325e9 100644 --- a/test/unit/presenters/formats/completed_transaction_presenter_test.rb +++ b/test/unit/presenters/formats/completed_transaction_presenter_test.rb @@ -18,7 +18,7 @@ def edition end def artefact - @_artefact ||= FactoryGirl.create(:artefact, kind: "completed_transaction") + @_artefact ||= FactoryGirl.create(:artefact, kind: "completed_transaction", slug: "done/artefact") end def result diff --git a/test/unit/services/search_indexer_test.rb b/test/unit/services/search_indexer_test.rb index 7c73681c4..d101b33ac 100644 --- a/test/unit/services/search_indexer_test.rb +++ b/test/unit/services/search_indexer_test.rb @@ -36,9 +36,16 @@ def test_indexing_to_rummager def test_format_exceptions_are_not_indexed SearchIndexer::FORMATS_NOT_TO_INDEX.each do |format| - artefact = FactoryGirl.create( - :artefact, kind: format, content_id: "content-id", - ) + if format == 'completed_transaction' + artefact = FactoryGirl.create( + :artefact, + kind: format, + slug: "done/something", + content_id: "content-id") + else + artefact = FactoryGirl.create(:artefact, kind: format, content_id: "content_id") + end + edition = FactoryGirl.create(:answer_edition, panopticon_id: artefact.id) search_index_presenter = SearchIndexPresenter.new(edition)