From 965ce317eb2daba46c34f5e3875e7dd221c53224 Mon Sep 17 00:00:00 2001 From: Laura Porter Date: Fri, 5 Apr 2024 16:42:03 +0100 Subject: [PATCH] Add tests to ensure deleted projects are not shown in project listing pages --- .../users_can_view_a_list_of_all_projects_spec.rb | 10 ++++++++++ .../users_can_view_their_projects_spec.rb | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/spec/features/projects/in_progress/users_can_view_a_list_of_all_projects_spec.rb b/spec/features/projects/in_progress/users_can_view_a_list_of_all_projects_spec.rb index a6e9e6f2d..1ab4e5380 100644 --- a/spec/features/projects/in_progress/users_can_view_a_list_of_all_projects_spec.rb +++ b/spec/features/projects/in_progress/users_can_view_a_list_of_all_projects_spec.rb @@ -62,5 +62,15 @@ expect(page).to have_content("Form a MAT project?") expect(page).to have_content("Yes") end + + scenario "deleted projects are not shown" do + deleted_project = create(:conversion_project, :deleted, urn: 121583) + in_progress_project = create(:conversion_project, urn: 115652) + + visit all_in_progress_projects_path + + expect(page).to_not have_content(deleted_project.urn.to_s) + expect(page).to have_content(in_progress_project.urn.to_s) + end end end diff --git a/spec/features/your_projects/users_can_view_their_projects_spec.rb b/spec/features/your_projects/users_can_view_their_projects_spec.rb index 6582d9d58..ee9129d4d 100644 --- a/spec/features/your_projects/users_can_view_their_projects_spec.rb +++ b/spec/features/your_projects/users_can_view_their_projects_spec.rb @@ -30,6 +30,15 @@ expect(page).to have_content(project.outgoing_trust.name) end + scenario "they do not see deleted projects" do + project = create(:transfer_project, :deleted, assigned_to: user) + + visit in_progress_your_projects_path + + expect(page).to_not have_content(project.establishment.name) + expect(page).to_not have_content(project.urn) + end + context "when they are NOT in the Regional casework services team" do let(:user) { create(:regional_delivery_officer_user) }