Browse Source

Merge branch 'main' into UpdatePipelines

pull/2852/head
Rachael Booth 6 months ago committed by GitHub
parent
commit
78a0a60673
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/controllers/schemes_controller.rb
  2. 18
      app/helpers/schemes_helper.rb
  3. 2
      app/models/form/sales/questions/equity.rb
  4. 2
      app/models/form/sales/questions/value.rb
  5. 8
      app/models/validations/sales/sale_information_validations.rb
  6. 2
      app/views/schemes/confirm_secondary.html.erb
  7. 2
      app/views/schemes/details.html.erb
  8. 8
      app/views/schemes/primary_client_group.html.erb
  9. 2
      app/views/schemes/secondary_client_group.html.erb
  10. 2
      app/views/schemes/support.html.erb
  11. 2
      config/locales/forms/2023/lettings/household_characteristics.en.yml
  12. 2
      config/locales/forms/2023/lettings/income_and_benefits.en.yml
  13. 40
      config/locales/forms/2023/sales/household_characteristics.en.yml
  14. 2
      config/locales/forms/2023/sales/income_benefits_and_savings.en.yml
  15. 10
      config/locales/forms/2023/sales/sale_information.en.yml
  16. 2
      config/locales/forms/2024/lettings/household_characteristics.en.yml
  17. 2
      config/locales/forms/2024/lettings/income_and_benefits.en.yml
  18. 40
      config/locales/forms/2024/sales/household_characteristics.en.yml
  19. 2
      config/locales/forms/2024/sales/income_benefits_and_savings.en.yml
  20. 10
      config/locales/forms/2024/sales/sale_information.en.yml
  21. 2
      config/locales/forms/2025/lettings/household_characteristics.en.yml
  22. 2
      config/locales/forms/2025/lettings/income_and_benefits.en.yml
  23. 20
      config/locales/forms/2025/sales/household_characteristics.en.yml
  24. 2
      config/locales/forms/2025/sales/income_benefits_and_savings.en.yml
  25. 8
      config/locales/forms/2025/sales/sale_information.en.yml
  26. 2
      config/locales/forms/2025/sales/setup.en.yml
  27. 4
      spec/models/form/sales/pages/equity_spec.rb
  28. 4
      spec/models/form/sales/pages/value_shared_ownership_spec.rb
  29. 4
      spec/models/form/sales/questions/equity_spec.rb
  30. 2
      spec/requests/lettings_logs_controller_spec.rb
  31. 8
      spec/requests/organisation_relationships_controller_spec.rb
  32. 6
      spec/requests/organisations_controller_spec.rb
  33. 2
      spec/requests/sales_logs_controller_spec.rb
  34. 74
      spec/requests/schemes_controller_spec.rb

4
app/controllers/schemes_controller.rb

@ -150,7 +150,7 @@ class SchemesController < ApplicationController
@scheme.update!(secondary_client_group: nil) if @scheme.has_other_client_group == "No" @scheme.update!(secondary_client_group: nil) if @scheme.has_other_client_group == "No"
if scheme_params[:confirmed] == "true" || @scheme.confirmed? if scheme_params[:confirmed] == "true" || @scheme.confirmed?
if check_answers && should_direct_via_secondary_client_group_page?(page) if check_answers && should_direct_via_secondary_client_group_page?(page)
redirect_to scheme_secondary_client_group_path(@scheme, referrer: "check-answers") redirect_to scheme_secondary_client_group_path(@scheme, referrer: "has-other-client-group")
else else
@scheme.locations.update!(confirmed: true) @scheme.locations.update!(confirmed: true)
flash[:notice] = if scheme_previously_confirmed flash[:notice] = if scheme_previously_confirmed
@ -162,7 +162,7 @@ class SchemesController < ApplicationController
end end
elsif check_answers elsif check_answers
if should_direct_via_secondary_client_group_page?(page) if should_direct_via_secondary_client_group_page?(page)
redirect_to scheme_secondary_client_group_path(@scheme, referrer: "check-answers") redirect_to scheme_secondary_client_group_path(@scheme, referrer: "has-other-client-group")
else else
redirect_to scheme_check_answers_path(@scheme) redirect_to scheme_check_answers_path(@scheme)
end end

18
app/helpers/schemes_helper.rb

@ -101,6 +101,24 @@ module SchemesHelper
organisation.owned_schemes.duplicate_sets.any? || organisation.owned_schemes.any? { |scheme| scheme.locations.duplicate_sets.any? } organisation.owned_schemes.duplicate_sets.any? || organisation.owned_schemes.any? { |scheme| scheme.locations.duplicate_sets.any? }
end end
def scheme_back_button_path(scheme, current_page)
return scheme_check_answers_path(scheme) if request.params[:referrer] == "check-answers"
return scheme_confirm_secondary_client_group_path(scheme, referrer: "check-answers") if request.params[:referrer] == "has-other-client-group"
case current_page
when "details"
schemes_path
when "primary_client_group"
scheme_details_path(scheme)
when "confirm_secondary_client_group"
scheme_primary_client_group_path(scheme)
when "secondary_client_group"
scheme_confirm_secondary_client_group_path(scheme)
when "support"
scheme.has_other_client_group == "Yes" ? scheme_secondary_client_group_path(scheme) : scheme_confirm_secondary_client_group_path(scheme)
end
end
private private
ActivePeriod = Struct.new(:from, :to) ActivePeriod = Struct.new(:from, :to)

2
app/models/form/sales/questions/equity.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::Equity < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "equity" @id = "equity"
@copy_key = "sales.sale_information.equity.#{page.id}" @copy_key = form.start_year_2025_or_later? ? "sales.sale_information.equity.#{page.id}" : "sales.sale_information.equity"
@type = "numeric" @type = "numeric"
@min = 0 @min = 0
@max = 100 @max = 100

2
app/models/form/sales/questions/value.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::Value < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "value" @id = "value"
@copy_key = "sales.sale_information.value.#{page.id}" @copy_key = form.start_year_2025_or_later? ? "sales.sale_information.value.#{page.id}" : "sales.sale_information.value"
@type = "numeric" @type = "numeric"
@min = 0 @min = 0
@step = 1 @step = 1

8
app/models/validations/sales/sale_information_validations.rb

@ -64,7 +64,7 @@ module Validations::Sales::SaleInformationValidations
if over_tolerance?(record.mortgage_deposit_and_grant_total, record.value_with_discount, tolerance, strict: !record.discount.nil?) && record.discounted_ownership_sale? if over_tolerance?(record.mortgage_deposit_and_grant_total, record.value_with_discount, tolerance, strict: !record.discount.nil?) && record.discounted_ownership_sale?
deposit_and_grant_sentence = record.grant.present? ? ", cash deposit (#{record.field_formatted_as_currency('deposit')}), and grant (#{record.field_formatted_as_currency('grant')})" : " and cash deposit (#{record.field_formatted_as_currency('deposit')})" deposit_and_grant_sentence = record.grant.present? ? ", cash deposit (#{record.field_formatted_as_currency('deposit')}), and grant (#{record.field_formatted_as_currency('grant')})" : " and cash deposit (#{record.field_formatted_as_currency('deposit')})"
discount_sentence = record.discount.present? ? " (#{record.field_formatted_as_currency('value')}) subtracted by the sum of the full purchase price (#{record.field_formatted_as_currency('value')}) multiplied by the percentage discount (#{record.discount}%)" : "" discount_sentence = record.discount.present? ? " (#{record.field_formatted_as_currency('value')}) subtracted by the sum of the full purchase price (#{record.field_formatted_as_currency('value')}) multiplied by the percentage discount (#{record.discount}%)" : ""
%i[mortgageused mortgage value deposit ownershipsch discount grant].each do |field| %i[mortgageused mortgage value deposit discount grant].each do |field|
record.errors.add field, I18n.t("validations.sales.sale_information.#{field}.discounted_ownership_value", record.errors.add field, I18n.t("validations.sales.sale_information.#{field}.discounted_ownership_value",
mortgage: record.mortgage&.positive? ? " (#{record.field_formatted_as_currency('mortgage')})" : "", mortgage: record.mortgage&.positive? ? " (#{record.field_formatted_as_currency('mortgage')})" : "",
deposit_and_grant_sentence:, deposit_and_grant_sentence:,
@ -72,6 +72,12 @@ module Validations::Sales::SaleInformationValidations
discount_sentence:, discount_sentence:,
value_with_discount: record.field_formatted_as_currency("value_with_discount")).html_safe value_with_discount: record.field_formatted_as_currency("value_with_discount")).html_safe
end end
record.errors.add :ownershipsch, :skip_bu_error, message: I18n.t("validations.sales.sale_information.ownershipsch.discounted_ownership_value",
mortgage: record.mortgage&.positive? ? " (#{record.field_formatted_as_currency('mortgage')})" : "",
deposit_and_grant_sentence:,
mortgage_deposit_and_grant_total: record.field_formatted_as_currency("mortgage_deposit_and_grant_total"),
discount_sentence:,
value_with_discount: record.field_formatted_as_currency("value_with_discount")).html_safe
end end
end end

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

@ -1,7 +1,7 @@
<% content_for :title, "Does this scheme provide for another client group?" %> <% content_for :title, "Does this scheme provide for another client group?" %>
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link(href: :back) %> <%= govuk_back_link(href: scheme_back_button_path(@scheme, "confirm_secondary_client_group")) %>
<% end %> <% end %>
<%= render partial: "organisations/headings", locals: { main: "Does this scheme provide for another client group?", sub: @scheme.service_name } %> <%= render partial: "organisations/headings", locals: { main: "Does this scheme provide for another client group?", sub: @scheme.service_name } %>

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

@ -1,7 +1,7 @@
<% content_for :title, "Create a new supported housing scheme" %> <% content_for :title, "Create a new supported housing scheme" %>
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link(href: :back) %> <%= govuk_back_link(href: scheme_back_button_path(@scheme, "details")) %>
<% end %> <% end %>
<%= form_for(@scheme, method: :patch) do |f| %> <%= form_for(@scheme, method: :patch) do |f| %>

8
app/views/schemes/primary_client_group.html.erb

@ -1,13 +1,7 @@
<% content_for :title, "What client group is this scheme intended for?" %> <% content_for :title, "What client group is this scheme intended for?" %>
<% if request.referer&.include?("new") %>
<% back_button_path = scheme_details_path(@scheme) %>
<% else %>
<% back_button_path = :back %>
<% end %>
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link(href: back_button_path) %> <%= govuk_back_link(href: scheme_back_button_path(@scheme, "primary_client_group")) %>
<% end %> <% end %>
<%= form_for(@scheme, method: :patch) do |f| %> <%= form_for(@scheme, method: :patch) do |f| %>

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

@ -1,7 +1,7 @@
<% content_for :title, "What is the other client group?" %> <% content_for :title, "What is the other client group?" %>
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link(href: :back) %> <%= govuk_back_link(href: scheme_back_button_path(@scheme, "secondary_client_group")) %>
<% end %> <% end %>
<%= form_for(@scheme, method: :patch) do |f| %> <%= form_for(@scheme, method: :patch) do |f| %>

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

@ -1,7 +1,7 @@
<% content_for :title, "What support does this scheme provide?" %> <% content_for :title, "What support does this scheme provide?" %>
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link(href: :back) %> <%= govuk_back_link(href: scheme_back_button_path(@scheme, "support")) %>
<% end %> <% end %>
<%= form_for(@scheme, method: :patch) do |f| %> <%= form_for(@scheme, method: :patch) do |f| %>

2
config/locales/forms/2023/lettings/household_characteristics.en.yml

@ -19,7 +19,7 @@ en:
page_header: "" page_header: ""
age1_known: age1_known:
check_answer_label: "" check_answer_label: ""
hint_text: "The lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." hint_text: "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
question_text: "Do you know the lead tenant’s age?" question_text: "Do you know the lead tenant’s age?"
age1: age1:
check_answer_label: "Lead tenant’s age" check_answer_label: "Lead tenant’s age"

2
config/locales/forms/2023/lettings/income_and_benefits.en.yml

@ -103,6 +103,6 @@ en:
hint_text: "You only need to give an approximate figure." hint_text: "You only need to give an approximate figure."
question_text: "Can you estimate the outstanding amount?" question_text: "Can you estimate the outstanding amount?"
tshortfall: tshortfall:
check_answer_label: "Estimated outstanding amountt" check_answer_label: "Estimated outstanding amount"
hint_text: "Also known as the ‘outstanding amount’." hint_text: "Also known as the ‘outstanding amount’."
question_text: "Estimated outstanding amount" question_text: "Estimated outstanding amount"

40
config/locales/forms/2023/sales/household_characteristics.en.yml

@ -103,9 +103,9 @@ en:
question_text: "What is buyer 2's relationship to buyer 1?" question_text: "What is buyer 2's relationship to buyer 1?"
person: person:
page_header: "" page_header: ""
check_answer_label: "Person 2’s relationship to Buyer 1" check_answer_label: "Person 2’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 2’s relationship to Buyer 1?" question_text: "What is person 2’s relationship to buyer 1?"
age2: age2:
buyer: buyer:
@ -139,7 +139,7 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 2’s gender identity" check_answer_label: "Person 2’s gender identity"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 2’s gender identity?" question_text: "Which of these best describes person 2’s gender identity?"
ethnic_group2: ethnic_group2:
page_header: "" page_header: ""
@ -190,7 +190,7 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 2’s working situation" check_answer_label: "Person 2’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 2’s working situation?" question_text: "Which of these best describes person 2’s working situation?"
buy2livein: buy2livein:
page_header: "" page_header: ""
@ -224,9 +224,9 @@ en:
relat3: relat3:
page_header: "" page_header: ""
check_answer_label: "Person 3’s relationship to Buyer 1" check_answer_label: "Person 3’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 3’s relationship to Buyer 1?" question_text: "What is person 3’s relationship to buyer 1?"
age3: age3:
page_header: "" page_header: ""
@ -243,13 +243,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 3’s gender identity" check_answer_label: "Person 3’s gender identity"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 3’s gender identity?" question_text: "Which of these best describes person 3’s gender identity?"
ecstat3: ecstat3:
page_header: "" page_header: ""
check_answer_label: "Person 3’s working situation" check_answer_label: "Person 3’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 3’s working situation?" question_text: "Which of these best describes person 3’s working situation?"
details_known_4: details_known_4:
page_header: "" page_header: ""
@ -259,9 +259,9 @@ en:
relat4: relat4:
page_header: "" page_header: ""
check_answer_label: "Person 4’s relationship to Buyer 1" check_answer_label: "Person 4’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 4’s relationship to Buyer 1?" question_text: "What is person 4’s relationship to buyer 1?"
age4: age4:
page_header: "" page_header: ""
@ -278,13 +278,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 4’s gender identity" check_answer_label: "Person 4’s gender identity"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 4’s gender identity?" question_text: "Which of these best describes person 4’s gender identity?"
ecstat4: ecstat4:
page_header: "" page_header: ""
check_answer_label: "Person 4’s working situation" check_answer_label: "Person 4’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 4’s working situation?" question_text: "Which of these best describes person 4’s working situation?"
details_known_5: details_known_5:
page_header: "" page_header: ""
@ -294,9 +294,9 @@ en:
relat5: relat5:
page_header: "" page_header: ""
check_answer_label: "Person 5’s relationship to Buyer 1" check_answer_label: "Person 5’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 5’s relationship to Buyer 1?" question_text: "What is person 5’s relationship to buyer 1?"
age5: age5:
page_header: "" page_header: ""
@ -313,13 +313,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 5’s gender identity" check_answer_label: "Person 5’s gender identity"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 5’s gender identity?" question_text: "Which of these best describes person 5’s gender identity?"
ecstat5: ecstat5:
page_header: "" page_header: ""
check_answer_label: "Person 5’s working situation" check_answer_label: "Person 5’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 5’s working situation?" question_text: "Which of these best describes person 5’s working situation?"
details_known_6: details_known_6:
page_header: "" page_header: ""
@ -329,9 +329,9 @@ en:
relat6: relat6:
page_header: "" page_header: ""
check_answer_label: "Person 6’s relationship to Buyer 1" check_answer_label: "Person 6’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 6’s relationship to Buyer 1?" question_text: "What is person 6’s relationship to buyer 1?"
age6: age6:
page_header: "" page_header: ""
@ -348,10 +348,10 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 6’s gender identity" check_answer_label: "Person 6’s gender identity"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 6’s gender identity?" question_text: "Which of these best describes person 6’s gender identity?"
ecstat6: ecstat6:
page_header: "" page_header: ""
check_answer_label: "Person 6’s working situation" check_answer_label: "Person 6’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 6’s working situation?" question_text: "Which of these best describes person 6’s working situation?"

2
config/locales/forms/2023/sales/income_benefits_and_savings.en.yml

@ -55,7 +55,7 @@ en:
savingsnk: savingsnk:
check_answer_label: "Buyers’ total savings known?" check_answer_label: "Buyers’ total savings known?"
hint_text: "" hint_text: ""
question_text: "Do you know how much the 'buyers' had in savings before they paid any deposit for the property?" question_text: "Do you know how much the buyers had in savings before they paid any deposit for the property?"
savings: savings:
check_answer_label: "Buyers’ total savings before any deposit paid" check_answer_label: "Buyers’ total savings before any deposit paid"
hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account." hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account."

10
config/locales/forms/2023/sales/sale_information.en.yml

@ -28,7 +28,7 @@ en:
staircasing: staircasing:
page_header: "" page_header: ""
check_answer_label: "Staircasing transaction" check_answer_label: "Staircasing transaction"
hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property."
question_text: "Is this a staircasing transaction?" question_text: "Is this a staircasing transaction?"
about_staircasing: about_staircasing:
page_header: "About the staircasing transaction" page_header: "About the staircasing transaction"
@ -83,9 +83,9 @@ en:
question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?"
frombeds: frombeds:
page_header: "About the buyers’ previous property" page_header: ""
check_answer_label: "Number of bedrooms in previous property" check_answer_label: "Number of bedrooms in previous property"
hint_text: "For bedsits enter 1" hint_text: "A bedsit has 1 bedroom."
question_text: "How many bedrooms did the property have?" question_text: "How many bedrooms did the property have?"
fromprop: fromprop:
@ -113,13 +113,13 @@ en:
question_text: "What was the initial percentage equity stake purchased?" question_text: "What was the initial percentage equity stake purchased?"
mortgageused: mortgageused:
page_header: "Mortgage Amount" page_header: ""
check_answer_label: "Mortgage used" check_answer_label: "Mortgage used"
hint_text: "" hint_text: ""
question_text: "Was a mortgage used for the purchase of this property?" question_text: "Was a mortgage used for the purchase of this property?"
mortgage: mortgage:
page_header: "Mortgage Amount" page_header: ""
check_answer_label: "Mortgage amount" check_answer_label: "Mortgage amount"
hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound."
question_text: "What is the mortgage amount?" question_text: "What is the mortgage amount?"

2
config/locales/forms/2024/lettings/household_characteristics.en.yml

@ -13,7 +13,7 @@ en:
page_header: "" page_header: ""
age1_known: age1_known:
check_answer_label: "" check_answer_label: ""
hint_text: "The lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same amount of paid work, the lead tenant is whoever is the oldest." hint_text: "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
question_text: "Do you know the lead tenant’s age?" question_text: "Do you know the lead tenant’s age?"
age1: age1:
check_answer_label: "Lead tenant’s age" check_answer_label: "Lead tenant’s age"

2
config/locales/forms/2024/lettings/income_and_benefits.en.yml

@ -103,6 +103,6 @@ en:
hint_text: "You only need to give an approximate figure." hint_text: "You only need to give an approximate figure."
question_text: "Can you estimate the outstanding amount?" question_text: "Can you estimate the outstanding amount?"
tshortfall: tshortfall:
check_answer_label: "Estimated outstanding amountt" check_answer_label: "Estimated outstanding amount"
hint_text: "Also known as the ‘outstanding amount’." hint_text: "Also known as the ‘outstanding amount’."
question_text: "Estimated outstanding amount" question_text: "Estimated outstanding amount"

40
config/locales/forms/2024/sales/household_characteristics.en.yml

@ -85,9 +85,9 @@ en:
question_text: "What is buyer 2's relationship to buyer 1?" question_text: "What is buyer 2's relationship to buyer 1?"
person: person:
page_header: "" page_header: ""
check_answer_label: "Person 2’s relationship to Buyer 1" check_answer_label: "Person 2’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 2’s relationship to Buyer 1?" question_text: "What is person 2’s relationship to buyer 1?"
age2: age2:
buyer: buyer:
@ -121,7 +121,7 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 2’s gender identity" check_answer_label: "Person 2’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 2’s gender identity?" question_text: "Which of these best describes person 2’s gender identity?"
ethnic_group2: ethnic_group2:
page_header: "" page_header: ""
@ -178,7 +178,7 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 2’s working situation" check_answer_label: "Person 2’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 2’s working situation?" question_text: "Which of these best describes person 2’s working situation?"
buy2livein: buy2livein:
page_header: "" page_header: ""
@ -212,9 +212,9 @@ en:
relat3: relat3:
page_header: "" page_header: ""
check_answer_label: "Person 3’s relationship to Buyer 1" check_answer_label: "Person 3’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 3’s relationship to Buyer 1?" question_text: "What is person 3’s relationship to buyer 1?"
age3: age3:
page_header: "" page_header: ""
@ -231,13 +231,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 3’s gender identity" check_answer_label: "Person 3’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 3’s gender identity?" question_text: "Which of these best describes person 3’s gender identity?"
ecstat3: ecstat3:
page_header: "" page_header: ""
check_answer_label: "Person 3’s working situation" check_answer_label: "Person 3’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 3’s working situation?" question_text: "Which of these best describes person 3’s working situation?"
details_known_4: details_known_4:
page_header: "" page_header: ""
@ -247,9 +247,9 @@ en:
relat4: relat4:
page_header: "" page_header: ""
check_answer_label: "Person 4’s relationship to Buyer 1" check_answer_label: "Person 4’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 4’s relationship to Buyer 1?" question_text: "What is person 4’s relationship to buyer 1?"
age4: age4:
page_header: "" page_header: ""
@ -266,13 +266,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 4’s gender identity" check_answer_label: "Person 4’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 4’s gender identity?" question_text: "Which of these best describes person 4’s gender identity?"
ecstat4: ecstat4:
page_header: "" page_header: ""
check_answer_label: "Person 4’s working situation" check_answer_label: "Person 4’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 4’s working situation?" question_text: "Which of these best describes person 4’s working situation?"
details_known_5: details_known_5:
page_header: "" page_header: ""
@ -282,9 +282,9 @@ en:
relat5: relat5:
page_header: "" page_header: ""
check_answer_label: "Person 5’s relationship to Buyer 1" check_answer_label: "Person 5’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 5’s relationship to Buyer 1?" question_text: "What is person 5’s relationship to buyer 1?"
age5: age5:
page_header: "" page_header: ""
@ -301,13 +301,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 5’s gender identity" check_answer_label: "Person 5’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 5’s gender identity?" question_text: "Which of these best describes person 5’s gender identity?"
ecstat5: ecstat5:
page_header: "" page_header: ""
check_answer_label: "Person 5’s working situation" check_answer_label: "Person 5’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 5’s working situation?" question_text: "Which of these best describes person 5’s working situation?"
details_known_6: details_known_6:
page_header: "" page_header: ""
@ -317,9 +317,9 @@ en:
relat6: relat6:
page_header: "" page_header: ""
check_answer_label: "Person 6’s relationship to Buyer 1" check_answer_label: "Person 6’s relationship to buyer 1"
hint_text: "" hint_text: ""
question_text: "What is Person 6’s relationship to Buyer 1?" question_text: "What is person 6’s relationship to buyer 1?"
age6: age6:
page_header: "" page_header: ""
@ -336,10 +336,10 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 6’s gender identity" check_answer_label: "Person 6’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 6’s gender identity?" question_text: "Which of these best describes person 6’s gender identity?"
ecstat6: ecstat6:
page_header: "" page_header: ""
check_answer_label: "Person 6’s working situation" check_answer_label: "Person 6’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 6’s working situation?" question_text: "Which of these best describes person 6’s working situation?"

2
config/locales/forms/2024/sales/income_benefits_and_savings.en.yml

@ -55,7 +55,7 @@ en:
savingsnk: savingsnk:
check_answer_label: "Buyers’ total savings known?" check_answer_label: "Buyers’ total savings known?"
hint_text: "" hint_text: ""
question_text: "Do you know how much the 'buyers' had in savings before they paid any deposit for the property?" question_text: "Do you know how much the buyers had in savings before they paid any deposit for the property?"
savings: savings:
check_answer_label: "Buyers’ total savings before any deposit paid" check_answer_label: "Buyers’ total savings before any deposit paid"
hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account." hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account."

10
config/locales/forms/2024/sales/sale_information.en.yml

@ -28,7 +28,7 @@ en:
staircasing: staircasing:
page_header: "" page_header: ""
check_answer_label: "Staircasing transaction" check_answer_label: "Staircasing transaction"
hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property."
question_text: "Is this a staircasing transaction?" question_text: "Is this a staircasing transaction?"
about_staircasing: about_staircasing:
page_header: "About the staircasing transaction" page_header: "About the staircasing transaction"
@ -87,9 +87,9 @@ en:
question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?"
frombeds: frombeds:
page_header: "About the buyers’ previous property" page_header: ""
check_answer_label: "Number of bedrooms in previous property" check_answer_label: "Number of bedrooms in previous property"
hint_text: "For bedsits enter 1" hint_text: "A bedsit has 1 bedroom."
question_text: "How many bedrooms did the property have?" question_text: "How many bedrooms did the property have?"
fromprop: fromprop:
@ -117,13 +117,13 @@ en:
question_text: "What was the initial percentage equity stake purchased?" question_text: "What was the initial percentage equity stake purchased?"
mortgageused: mortgageused:
page_header: "Mortgage Amount" page_header: ""
check_answer_label: "Mortgage used" check_answer_label: "Mortgage used"
hint_text: "" hint_text: ""
question_text: "Was a mortgage used for the purchase of this property?" question_text: "Was a mortgage used for the purchase of this property?"
mortgage: mortgage:
page_header: "Mortgage Amount" page_header: ""
check_answer_label: "Mortgage amount" check_answer_label: "Mortgage amount"
hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound."
question_text: "What is the mortgage amount?" question_text: "What is the mortgage amount?"

2
config/locales/forms/2025/lettings/household_characteristics.en.yml

@ -13,7 +13,7 @@ en:
page_header: "" page_header: ""
age1_known: age1_known:
check_answer_label: "" check_answer_label: ""
hint_text: "The lead’ or ’main’ tenant is the person in the household who does the most paid work. If several people do the same amount of paid work, the lead tenant is whoever is the oldest." hint_text: "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
question_text: "Do you know the lead tenant’s age?" question_text: "Do you know the lead tenant’s age?"
age1: age1:
check_answer_label: "Lead tenant’s age" check_answer_label: "Lead tenant’s age"

2
config/locales/forms/2025/lettings/income_and_benefits.en.yml

@ -103,6 +103,6 @@ en:
hint_text: "You only need to give an approximate figure." hint_text: "You only need to give an approximate figure."
question_text: "Can you estimate the outstanding amount?" question_text: "Can you estimate the outstanding amount?"
tshortfall: tshortfall:
check_answer_label: "Estimated outstanding amountt" check_answer_label: "Estimated outstanding amount"
hint_text: "Also known as the ‘outstanding amount’." hint_text: "Also known as the ‘outstanding amount’."
question_text: "Estimated outstanding amount" question_text: "Estimated outstanding amount"

20
config/locales/forms/2025/sales/household_characteristics.en.yml

@ -121,7 +121,7 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 2’s gender identity" check_answer_label: "Person 2’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 2’s gender identity?" question_text: "Which of these best describes person 2’s gender identity?"
ethnic_group2: ethnic_group2:
page_header: "" page_header: ""
@ -178,7 +178,7 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 2’s working situation" check_answer_label: "Person 2’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 2’s working situation?" question_text: "Which of these best describes person 2’s working situation?"
buy2livein: buy2livein:
page_header: "" page_header: ""
@ -231,13 +231,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 3’s gender identity" check_answer_label: "Person 3’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 3’s gender identity?" question_text: "Which of these best describes person 3’s gender identity?"
ecstat3: ecstat3:
page_header: "" page_header: ""
check_answer_label: "Person 3’s working situation" check_answer_label: "Person 3’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 3’s working situation?" question_text: "Which of these best describes person 3’s working situation?"
details_known_4: details_known_4:
page_header: "" page_header: ""
@ -266,13 +266,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 4’s gender identity" check_answer_label: "Person 4’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 4’s gender identity?" question_text: "Which of these best describes person 4’s gender identity?"
ecstat4: ecstat4:
page_header: "" page_header: ""
check_answer_label: "Person 4’s working situation" check_answer_label: "Person 4’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 4’s working situation?" question_text: "Which of these best describes person 4’s working situation?"
details_known_5: details_known_5:
page_header: "" page_header: ""
@ -301,13 +301,13 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 5’s gender identity" check_answer_label: "Person 5’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 5’s gender identity?" question_text: "Which of these best describes person 5’s gender identity?"
ecstat5: ecstat5:
page_header: "" page_header: ""
check_answer_label: "Person 5’s working situation" check_answer_label: "Person 5’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 5’s working situation?" question_text: "Which of these best describes person 5’s working situation?"
details_known_6: details_known_6:
page_header: "" page_header: ""
@ -336,10 +336,10 @@ en:
page_header: "" page_header: ""
check_answer_label: "Person 6’s gender identity" check_answer_label: "Person 6’s gender identity"
hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth." hint_text: "This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth."
question_text: "Which of these best describes Person 6’s gender identity?" question_text: "Which of these best describes person 6’s gender identity?"
ecstat6: ecstat6:
page_header: "" page_header: ""
check_answer_label: "Person 6’s working situation" check_answer_label: "Person 6’s working situation"
hint_text: "" hint_text: ""
question_text: "Which of these best describes Person 6’s working situation?" question_text: "Which of these best describes person 6’s working situation?"

2
config/locales/forms/2025/sales/income_benefits_and_savings.en.yml

@ -55,7 +55,7 @@ en:
savingsnk: savingsnk:
check_answer_label: "Buyers’ total savings known?" check_answer_label: "Buyers’ total savings known?"
hint_text: "" hint_text: ""
question_text: "Do you know how much the 'buyers' had in savings before they paid any deposit for the property?" question_text: "Do you know how much the buyers had in savings before they paid any deposit for the property?"
savings: savings:
check_answer_label: "Buyers’ total savings before any deposit paid" check_answer_label: "Buyers’ total savings before any deposit paid"
hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account." hint_text: "Include any savings, investments, ISAs, premium bonds, shares, or money held in a bank or building society account."

8
config/locales/forms/2025/sales/sale_information.en.yml

@ -105,9 +105,9 @@ en:
question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" question_text: "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?"
frombeds: frombeds:
page_header: "About the buyers’ previous property" page_header: ""
check_answer_label: "Number of bedrooms in previous property" check_answer_label: "Number of bedrooms in previous property"
hint_text: "For bedsits enter 1" hint_text: "A bedsit has 1 bedroom."
question_text: "How many bedrooms did the property have?" question_text: "How many bedrooms did the property have?"
fromprop: fromprop:
@ -145,13 +145,13 @@ en:
question_text: "What was the percentage shared purchased in the initial transaction?" question_text: "What was the percentage shared purchased in the initial transaction?"
mortgageused: mortgageused:
page_header: "Mortgage Amount" page_header: ""
check_answer_label: "Mortgage used?" check_answer_label: "Mortgage used?"
hint_text: "" hint_text: ""
question_text: "Was a mortgage used for the purchase of this property?" question_text: "Was a mortgage used for the purchase of this property?"
mortgage: mortgage:
page_header: "Mortgage Amount" page_header: ""
check_answer_label: "Mortgage amount" check_answer_label: "Mortgage amount"
hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound." hint_text: "Enter the amount of mortgage agreed with the mortgage lender. Exclude any deposits or cash payments. Numeric in pounds. Rounded to the nearest pound."
question_text: "What is the mortgage amount?" question_text: "What is the mortgage amount?"

2
config/locales/forms/2025/sales/setup.en.yml

@ -42,7 +42,7 @@ en:
staircasing: staircasing:
page_header: "" page_header: ""
check_answer_label: "Staircasing transaction" check_answer_label: "Staircasing transaction"
hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" hint_text: "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property."
question_text: "Is this a staircasing transaction?" question_text: "Is this a staircasing transaction?"
type: type:

4
spec/models/form/sales/pages/equity_spec.rb

@ -7,6 +7,10 @@ RSpec.describe Form::Sales::Pages::Equity, type: :model do
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) }
before do
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(false)
end
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
end end

4
spec/models/form/sales/pages/value_shared_ownership_spec.rb

@ -7,6 +7,10 @@ RSpec.describe Form::Sales::Pages::ValueSharedOwnership, type: :model do
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) }
before do
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(false)
end
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
end end

4
spec/models/form/sales/questions/equity_spec.rb

@ -7,6 +7,10 @@ RSpec.describe Form::Sales::Questions::Equity, type: :model do
let(:question_definition) { nil } let(:question_definition) { nil }
let(:page) { instance_double(Form::Page, id: "initial_equity", subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } let(:page) { instance_double(Form::Page, id: "initial_equity", subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
before do
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(false)
end
it "has correct page" do it "has correct page" do
expect(question.page).to eq(page) expect(question.page).to eq(page)
end end

2
spec/requests/lettings_logs_controller_spec.rb

@ -1483,7 +1483,7 @@ RSpec.describe LettingsLogsController, type: :request do
end end
context "when viewing a collection of logs affected by deactivated location" do context "when viewing a collection of logs affected by deactivated location" do
let!(:affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 3, unresolved: true, assigned_to: user) } let!(:affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 3, unresolved: true, assigned_to: user, tenancycode: "affected tenancycode", propcode: "affected propcode") }
let!(:other_user_affected_lettings_log) { FactoryBot.create(:lettings_log, unresolved: true) } let!(:other_user_affected_lettings_log) { FactoryBot.create(:lettings_log, unresolved: true) }
let!(:non_affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 4, assigned_to: user) } let!(:non_affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 4, assigned_to: user) }
let(:other_user) { FactoryBot.create(:user, organisation: user.organisation) } let(:other_user) { FactoryBot.create(:user, organisation: user.organisation) }

8
spec/requests/organisation_relationships_controller_spec.rb

@ -40,7 +40,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of stock owners" do it "shows a table of stock owners" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(stock_owner.name) expect(CGI.unescapeHTML(response.body)).to include(stock_owner.name)
end end
it "shows only stock owners for the current user's organisation" do it "shows only stock owners for the current user's organisation" do
@ -136,7 +136,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of managing-agents" do it "shows a table of managing-agents" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(managing_agent.name) expect(CGI.unescapeHTML(response.body)).to include(managing_agent.name)
end end
it "shows only managing-agents for the current user's organisation" do it "shows only managing-agents for the current user's organisation" do
@ -336,7 +336,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of stock owners" do it "shows a table of stock owners" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(stock_owner.name) expect(CGI.unescapeHTML(response.body)).to include(stock_owner.name)
end end
it "shows only stock owners for the current user's organisation" do it "shows only stock owners for the current user's organisation" do
@ -472,7 +472,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of managing agents" do it "shows a table of managing agents" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(managing_agent.name) expect(CGI.unescapeHTML(response.body)).to include(managing_agent.name)
end end
it "shows only managing agents for the current user's organisation" do it "shows only managing agents for the current user's organisation" do

6
spec/requests/organisations_controller_spec.rb

@ -487,7 +487,7 @@ RSpec.describe OrganisationsController, type: :request do
it "shows a summary list of org details" do it "shows a summary list of org details" do
expected_html = "<dl class=\"govuk-summary-list\"" expected_html = "<dl class=\"govuk-summary-list\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(organisation.name) expect(CGI.unescapeHTML(response.body)).to include(organisation.name)
end end
it "does not include a change details link" do it "does not include a change details link" do
@ -663,7 +663,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
it "shows an edit form without name field" do it "shows an edit form without name field" do
expect(response.body).to include("Change #{organisation.name}’s details") expect(CGI.unescapeHTML(response.body)).to include("Change #{organisation.name}’s details")
expect(page).not_to have_field("organisation-name-field") expect(page).not_to have_field("organisation-name-field")
expect(page).to have_field("organisation-phone-field") expect(page).to have_field("organisation-phone-field")
end end
@ -945,7 +945,7 @@ RSpec.describe OrganisationsController, type: :request do
it "shows a summary list of org details" do it "shows a summary list of org details" do
expected_html = "<dl class=\"govuk-summary-list\"" expected_html = "<dl class=\"govuk-summary-list\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(organisation.name) expect(CGI.unescapeHTML(response.body)).to include(organisation.name)
end end
it "does not have a change details link" do it "does not have a change details link" do

2
spec/requests/sales_logs_controller_spec.rb

@ -299,7 +299,7 @@ RSpec.describe SalesLogsController, type: :request do
it "does not render pending logs" do it "does not render pending logs" do
get "/sales-logs", headers: headers, params: {} get "/sales-logs", headers: headers, params: {}
expect(page).not_to have_link(invisible_log.id, href: "sales-logs/#{invisible_log.id}") expect(page).not_to have_link(invisible_log.id.to_s, href: "sales-logs/#{invisible_log.id}")
end end
end end

74
spec/requests/schemes_controller_spec.rb

@ -2035,6 +2035,17 @@ RSpec.describe SchemesController, type: :request do
expect(page).to have_content("What client group is this scheme intended for?") expect(page).to have_content("What client group is this scheme intended for?")
end end
it "has correct back link" do
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/details")
end
context "and accessed from check answers" do
it "has correct back link" do
get "/schemes/#{scheme.id}/primary-client-group?referrer=check-answers"
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/check-answers")
end
end
context "when attempting to access primary-client-group scheme page for another organisation" do context "when attempting to access primary-client-group scheme page for another organisation" do
before do before do
get "/schemes/#{another_scheme.id}/primary-client-group" get "/schemes/#{another_scheme.id}/primary-client-group"
@ -2112,6 +2123,17 @@ RSpec.describe SchemesController, type: :request do
expect(page).to have_content("Does this scheme provide for another client group?") expect(page).to have_content("Does this scheme provide for another client group?")
end end
it "has correct back link" do
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/primary-client-group")
end
context "and accessed from check answers" do
it "has correct back link" do
get "/schemes/#{scheme.id}/confirm-secondary-client-group?referrer=check-answers"
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/check-answers")
end
end
context "when attempting to access confirm-secondary-client-group scheme page for another organisation" do context "when attempting to access confirm-secondary-client-group scheme page for another organisation" do
before do before do
get "/schemes/#{another_scheme.id}/confirm-secondary-client-group" get "/schemes/#{another_scheme.id}/confirm-secondary-client-group"
@ -2189,6 +2211,24 @@ RSpec.describe SchemesController, type: :request do
expect(page).to have_content("What is the other client group?") expect(page).to have_content("What is the other client group?")
end end
it "has correct back link" do
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/confirm-secondary-client-group")
end
context "and accessed from check answers" do
it "has correct back link" do
get "/schemes/#{scheme.id}/secondary-client-group?referrer=check-answers"
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/check-answers")
end
end
context "and accessed from has other client group" do
it "has correct back link" do
get "/schemes/#{scheme.id}/secondary-client-group?referrer=has-other-client-group"
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/confirm-secondary-client-group?referrer=check-answers")
end
end
context "when attempting to access secondary-client-group scheme page for another organisation" do context "when attempting to access secondary-client-group scheme page for another organisation" do
before do before do
get "/schemes/#{another_scheme.id}/secondary-client-group" get "/schemes/#{another_scheme.id}/secondary-client-group"
@ -2258,7 +2298,7 @@ RSpec.describe SchemesController, type: :request do
context "when signed in as a data coordinator" do context "when signed in as a data coordinator" do
let(:user) { create(:user, :data_coordinator) } let(:user) { create(:user, :data_coordinator) }
let(:scheme) { create(:scheme, owning_organisation: user.organisation, confirmed: nil) } let(:scheme) { create(:scheme, owning_organisation: user.organisation, confirmed: nil, has_other_client_group: "Yes") }
let(:another_scheme) { create(:scheme, confirmed: nil) } let(:another_scheme) { create(:scheme, confirmed: nil) }
before do before do
@ -2271,6 +2311,27 @@ RSpec.describe SchemesController, type: :request do
expect(page).to have_content("What support does this scheme provide?") expect(page).to have_content("What support does this scheme provide?")
end end
context "when scheme has secondary client group" do
it "has correct back link" do
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/secondary-client-group")
end
end
context "when scheme has no secondary client group" do
let(:scheme) { create(:scheme, owning_organisation: user.organisation, confirmed: nil, has_other_client_group: "No") }
it "has correct back link" do
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/confirm-secondary-client-group")
end
end
context "and accessed from check answers" do
it "has correct back link" do
get "/schemes/#{scheme.id}/support?referrer=check-answers"
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/check-answers")
end
end
context "when attempting to access secondary-client-group scheme page for another organisation" do context "when attempting to access secondary-client-group scheme page for another organisation" do
before do before do
get "/schemes/#{another_scheme.id}/support" get "/schemes/#{another_scheme.id}/support"
@ -2433,6 +2494,17 @@ RSpec.describe SchemesController, type: :request do
expect(page).to have_content("Create a new supported housing scheme") expect(page).to have_content("Create a new supported housing scheme")
end end
it "has correct back link" do
expect(page).to have_link("Back", href: "/schemes")
end
context "and accessed from check answers" do
it "has correct back link" do
get "/schemes/#{scheme.id}/details?referrer=check-answers"
expect(page).to have_link("Back", href: "/schemes/#{scheme.id}/check-answers")
end
end
context "when attempting to access check-answers scheme page for another organisation" do context "when attempting to access check-answers scheme page for another organisation" do
before do before do
get "/schemes/#{another_scheme.id}/details" get "/schemes/#{another_scheme.id}/details"

Loading…
Cancel
Save