Browse Source

Filter out the primary client group option from secondary client group question (#809)

Co-authored-by: Sam Collard <Sam.Collard@softwire.com>

Co-authored-by: Sam Collard <Sam.Collard@softwire.com>
pull/797/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
9c7c964783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/views/schemes/secondary_client_group.html.erb
  2. 2
      spec/features/schemes_helpers.rb
  3. 7
      spec/requests/schemes_controller_spec.rb

2
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,

2
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

7
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

Loading…
Cancel
Save