diff --git a/app/views/schemes/secondary_client_group.html.erb b/app/views/schemes/secondary_client_group.html.erb index d229883ba..4f48dab00 100644 --- a/app/views/schemes/secondary_client_group.html.erb +++ b/app/views/schemes/secondary_client_group.html.erb @@ -14,7 +14,7 @@ <%= render partial: "organisations/headings", locals: { main: "What is the other client group?", sub: @scheme.service_name } %> - <% secondary_client_group_selection = Scheme.secondary_client_groups.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key) } %> + <% secondary_client_group_selection = Scheme.secondary_client_groups.keys.excluding("Missing", @scheme.primary_client_group).map { |key, _| OpenStruct.new(id: key, name: key) } %> <%= f.govuk_collection_radio_buttons :secondary_client_group, secondary_client_group_selection, :id, diff --git a/spec/features/schemes_helpers.rb b/spec/features/schemes_helpers.rb index d1a4db2dc..fdbec0c3a 100644 --- a/spec/features/schemes_helpers.rb +++ b/spec/features/schemes_helpers.rb @@ -44,7 +44,7 @@ module SchemesHelpers end def fill_in_and_save_secondary_client_group - choose "Homeless families with support needs" + choose "Offenders and people at risk of offending" click_button "Save and continue" end diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index ce6805f35..3ccc9e461 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -1334,7 +1334,7 @@ RSpec.describe SchemesController, type: :request do context "when signed in as a support user" do let(:user) { FactoryBot.create(:user, :support) } - let!(:scheme) { FactoryBot.create(:scheme) } + let!(:scheme) { FactoryBot.create(:scheme, primary_client_group: Scheme::PRIMARY_CLIENT_GROUP[:"Homeless families with support needs"]) } before do allow(user).to receive(:need_two_factor_authentication?).and_return(false) @@ -1346,6 +1346,11 @@ RSpec.describe SchemesController, type: :request do expect(response).to have_http_status(:ok) expect(page).to have_content("What is the other client group?") end + + it "does not show the primary client group as an option" do + expect(scheme.primary_client_group).not_to be_nil + expect(page).not_to have_content("Homeless families with support needs") + end end end