Browse Source

Do not display secondary client group if the scheme doesn't have one

pull/671/head
Kat 3 years ago committed by JG
parent
commit
e8f95b3ef1
  1. 2
      app/models/scheme.rb
  2. 2
      app/views/schemes/check_answers.html.erb
  3. 14
      spec/features/schemes_spec.rb

2
app/models/scheme.rb

@ -107,7 +107,7 @@ class Scheme < ApplicationRecord
def check_secondary_client_confirmation_attributes def check_secondary_client_confirmation_attributes
[ [
{ name: "Scheme provides for another client group", value: has_other_client_group }, { name: "Has another client group", value: has_other_client_group },
] ]
end end

2
app/views/schemes/check_answers.html.erb

@ -36,6 +36,7 @@
) %> ) %>
<% end %> <% end %>
<% end %> <% end %>
<% if @scheme.has_other_client_group == "Yes" %>
<% @scheme.check_secondary_client_attributes.each do |attr| %> <% @scheme.check_secondary_client_attributes.each do |attr| %>
<%= summary_list.row do |row| %> <%= summary_list.row do |row| %>
<% row.key { attr[:name].to_s } %> <% row.key { attr[:name].to_s } %>
@ -46,6 +47,7 @@
) %> ) %>
<% end %> <% end %>
<% end %> <% end %>
<% end %>
<% @scheme.check_support_attributes.each do |attr| %> <% @scheme.check_support_attributes.each do |attr| %>
<%= summary_list.row do |row| %> <%= summary_list.row do |row| %>
<% row.key { attr[:name].to_s } %> <% row.key { attr[:name].to_s } %>

14
spec/features/schemes_spec.rb

@ -353,17 +353,6 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "Check your changes before updating this scheme" expect(page).to have_content "Check your changes before updating this scheme"
end end
context "when I press the back button" do
before do
click_link "Back"
end
it "lets me select the support answers" do
expect(page).to have_current_path("/schemes/#{scheme.id}/support")
expect(page).to have_content "What support does this scheme provide?"
end
end
context "when changing answers" do context "when changing answers" do
it "displays change links" do it "displays change links" do
assert_selector "a", text: "Change", count: 12 assert_selector "a", text: "Change", count: 12
@ -456,7 +445,6 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "Check your changes before updating this scheme" expect(page).to have_content "Check your changes before updating this scheme"
end end
end end
end end
context "allows changing confirm-secondary-client-group question to no" do context "allows changing confirm-secondary-client-group question to no" do
@ -471,7 +459,7 @@ RSpec.describe "Schemes scheme Features" do
click_button "Save and continue" click_button "Save and continue"
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers")
expect(page).to have_content "None" expect(page).not_to have_content "Secondary client group"
end end
end end

Loading…
Cancel
Save