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. 18
      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
[
{ name: "Scheme provides for another client group", value: has_other_client_group },
{ name: "Has another client group", value: has_other_client_group },
]
end

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

@ -36,14 +36,16 @@
) %>
<% end %>
<% end %>
<% @scheme.check_secondary_client_attributes.each do |attr| %>
<%= summary_list.row do |row| %>
<% row.key { attr[:name].to_s } %>
<% row.value { details_html(attr) } %>
<% row.action(
text: "Change",
href: scheme_secondary_client_group_path(scheme_id: @scheme.id, check_answers: true),
) %>
<% if @scheme.has_other_client_group == "Yes" %>
<% @scheme.check_secondary_client_attributes.each do |attr| %>
<%= summary_list.row do |row| %>
<% row.key { attr[:name].to_s } %>
<% row.value { details_html(attr) } %>
<% row.action(
text: "Change",
href: scheme_secondary_client_group_path(scheme_id: @scheme.id, check_answers: true),
) %>
<% end %>
<% end %>
<% end %>
<% @scheme.check_support_attributes.each do |attr| %>

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"
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
it "displays change links" do
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"
end
end
end
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"
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

Loading…
Cancel
Save