Browse Source

Merge branch 'main' into CLDC-1394-schemes-cya

pull/797/head
kosiakkatrina 3 years ago committed by GitHub
parent
commit
a82519939f
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 } %> <%= 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, <%= f.govuk_collection_radio_buttons :secondary_client_group,
secondary_client_group_selection, secondary_client_group_selection,
:id, :id,

2
spec/features/schemes_helpers.rb

@ -44,7 +44,7 @@ module SchemesHelpers
end end
def fill_in_and_save_secondary_client_group 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" click_button "Save and continue"
end end

7
spec/requests/schemes_controller_spec.rb

@ -1366,7 +1366,7 @@ RSpec.describe SchemesController, type: :request do
context "when signed in as a support user" do context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) } let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) } let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil, primary_client_group: Scheme::PRIMARY_CLIENT_GROUP[:"Homeless families with support needs"]) }
before do before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false) allow(user).to receive(:need_two_factor_authentication?).and_return(false)
@ -1393,6 +1393,11 @@ RSpec.describe SchemesController, type: :request do
assert_select "a", text: /Change/, count: 3 assert_select "a", text: /Change/, count: 3
end end
end 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
end end

Loading…
Cancel
Save