Browse Source

CLDC-2199 Fix LA/rent soft validation bugs (#1538)

* feat: unrelated currency formatting

* Revert "feat: unrelated currency formatting"

This reverts commit 75bd3efbf8.

* feat: add soft val pages to property information section (not to setup)

* feat: update tests

* feat: update tests

* feat: add validation to setpu section

* refactor: lint

* test: update

* feat: set nil as default check answers card no

* feat: use : to define more explicitly

* feat: make optional as affects setup

* feat: update tests

* feat: put la in nil card with rest of uprn/address qs

* feat: route to uprn confirmation from check answers changes to uprn even though not an interruption screen

* feat: update tests

* feat: update tests

* refactor: lint

* feat: update tests

* feat: update tests

* feat: wip blank fields and dependent fields on upload tos ee if valid and can upload with missing info - this is not the exact ac on the ticket yet

* Revert "feat: wip blank fields and dependent fields on upload tos ee if valid and can upload with missing info - this is not the exact ac on the ticket yet"

This reverts commit 136e5f6f12.

* feat: fix uprn hidden in check answers

* feat: fix tests

* feat: fix tests
pull/1553/head
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
87d4497558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/controllers/form_controller.rb
  2. 8
      app/models/form/lettings/pages/max_rent_value_check.rb
  3. 14
      app/models/form/lettings/pages/min_rent_value_check.rb
  4. 2
      app/models/form/lettings/questions/la.rb
  5. 6
      app/models/form/lettings/questions/rent_value_check.rb
  6. 13
      app/models/form/lettings/questions/uprn_known.rb
  7. 4
      app/models/form/lettings/subsections/income_and_benefits.rb
  8. 4
      app/models/form/lettings/subsections/property_information.rb
  9. 8
      app/models/form/lettings/subsections/setup.rb
  10. 7
      app/models/form/sales/questions/uprn_known.rb
  11. 16
      app/models/lettings_log.rb
  12. 7
      app/models/validations/soft_validations.rb
  13. 4
      spec/fixtures/files/lettings_logs_download.csv
  14. 4
      spec/fixtures/files/lettings_logs_download_codes_only.csv
  15. 2
      spec/models/form/lettings/pages/max_rent_value_check_spec.rb
  16. 11
      spec/models/form/lettings/pages/min_rent_value_check_spec.rb
  17. 16
      spec/models/form/lettings/questions/uprn_known_spec.rb
  18. 4
      spec/models/form/lettings/subsections/income_and_benefits_spec.rb
  19. 8
      spec/models/form/lettings/subsections/property_information_spec.rb
  20. 16
      spec/models/form/lettings/subsections/setup_spec.rb
  21. 16
      spec/models/form/sales/questions/uprn_known_spec.rb
  22. 8
      spec/models/form_handler_spec.rb
  23. 2
      spec/models/lettings_log_spec.rb
  24. 2
      spec/services/csv/lettings_log_csv_service_spec.rb

4
app/controllers/form_controller.rb

@ -126,7 +126,7 @@ private
next_page = form.get_page(next_page_id) next_page = form.get_page(next_page_id)
previous_page = form.previous_page_id(@page, @log, current_user) previous_page = form.previous_page_id(@page, @log, current_user)
if next_page&.interruption_screen? || next_page_id == previous_page if next_page&.interruption_screen? || next_page_id == previous_page || CONFIRMATION_PAGE_IDS.include?(next_page_id)
return send("#{@log.class.name.underscore}_#{next_page_id}_path", @log, { referrer: "check_answers" }) return send("#{@log.class.name.underscore}_#{next_page_id}_path", @log, { referrer: "check_answers" })
else else
return send("#{@log.model_name.param_key}_#{form.subsection_for_page(@page).id}_check_answers_path", @log) return send("#{@log.model_name.param_key}_#{form.subsection_for_page(@page).id}_check_answers_path", @log)
@ -180,4 +180,6 @@ private
redirect_to lettings_log_path(@log) unless @log.collection_period_open? redirect_to lettings_log_path(@log) unless @log.collection_period_open?
end end
CONFIRMATION_PAGE_IDS = %w[uprn_confirmation].freeze
end end

8
app/models/form/lettings/pages/max_rent_value_check.rb

@ -1,7 +1,6 @@
class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection, check_answers_card_number: nil)
super super(id, hsh, subsection)
@id = "max_rent_value_check"
@depends_on = [{ "rent_in_soft_max_range?" => true }] @depends_on = [{ "rent_in_soft_max_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.rent.outside_range_title", "translation" => "soft_validations.rent.outside_range_title",
@ -23,9 +22,10 @@ class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page
}, },
], ],
} }
@check_answers_card_number = check_answers_card_number
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end end
end end

14
app/models/form/lettings/pages/min_rent_value_check.rb

@ -1,7 +1,6 @@
class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection, check_answers_card_number: nil)
super super(id, hsh, subsection)
@id = "min_rent_value_check"
@depends_on = [{ "rent_in_soft_min_range?" => true }] @depends_on = [{ "rent_in_soft_min_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.rent.outside_range_title", "translation" => "soft_validations.rent.outside_range_title",
@ -13,17 +12,16 @@ class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.rent.min_hint_text", "translation" => "soft_validations.rent.min_hint_text",
"arguments" => [ "arguments" => [{
{
"key" => "field_formatted_as_currency", "key" => "field_formatted_as_currency",
"arguments_for_key" => "soft_min_for_period", "arguments_for_key" => "soft_min_for_period",
"i18n_template" => "soft_min_for_period", "i18n_template" => "soft_min_for_period",
}, }],
],
} }
@check_answers_card_number = check_answers_card_number
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end end
end end

2
app/models/form/lettings/questions/la.rb

@ -5,7 +5,7 @@ class Form::Lettings::Questions::La < ::Form::Question
@check_answer_label = "Local Authority" @check_answer_label = "Local Authority"
@header = "What is the property’s local authority?" @header = "What is the property’s local authority?"
@type = "select" @type = "select"
@check_answers_card_number = 0 @check_answers_card_number = nil
@hint_text = "" @hint_text = ""
@question_number = 13 @question_number = 13
@disable_clearing_if_not_routed_or_dynamic_answer_options = true @disable_clearing_if_not_routed_or_dynamic_answer_options = true

6
app/models/form/lettings/questions/rent_value_check.rb

@ -1,11 +1,11 @@
class Form::Lettings::Questions::RentValueCheck < ::Form::Question class Form::Lettings::Questions::RentValueCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page, check_answers_card_number:)
super super(id, hsh, page)
@id = "rent_value_check" @id = "rent_value_check"
@check_answer_label = "Total rent confirmation" @check_answer_label = "Total rent confirmation"
@header = "Are you sure this is correct?" @header = "Are you sure this is correct?"
@type = "interruption_screen" @type = "interruption_screen"
@check_answers_card_number = 0 @check_answers_card_number = check_answers_card_number
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] } @hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] }
end end

13
app/models/form/lettings/questions/uprn_known.rb

@ -9,7 +9,18 @@ class Form::Lettings::Questions::UprnKnown < ::Form::Question
@hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.<br><br> @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.<br><br>
You can continue without the UPRN, but it means we will need you to enter the address of the property." You can continue without the UPRN, but it means we will need you to enter the address of the property."
@conditional_for = { "uprn" => [1] } @conditional_for = { "uprn" => [1] }
@hidden_in_check_answers = true @inferred_check_answers_value = [
{
"condition" => { "uprn_known" => 0 },
"value" => "Not known",
},
]
@hidden_in_check_answers = {
"depends_on" => [
{ "uprn_known" => 0 },
{ "uprn_known" => 1 },
],
}
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

4
app/models/form/lettings/subsections/income_and_benefits.rb

@ -24,8 +24,8 @@ class Form::Lettings::Subsections::IncomeAndBenefits < ::Form::Subsection
Form::Lettings::Pages::RentBiWeekly.new(nil, nil, self), Form::Lettings::Pages::RentBiWeekly.new(nil, nil, self),
Form::Lettings::Pages::Rent4Weekly.new(nil, nil, self), Form::Lettings::Pages::Rent4Weekly.new(nil, nil, self),
Form::Lettings::Pages::RentMonthly.new(nil, nil, self), Form::Lettings::Pages::RentMonthly.new(nil, nil, self),
Form::Lettings::Pages::MinRentValueCheck.new(nil, nil, self), Form::Lettings::Pages::MinRentValueCheck.new("brent_min_rent_value_check", nil, self, check_answers_card_number: 0),
Form::Lettings::Pages::MaxRentValueCheck.new(nil, nil, self), Form::Lettings::Pages::MaxRentValueCheck.new("brent_max_rent_value_check", nil, self, check_answers_card_number: 0),
Form::Lettings::Pages::Outstanding.new(nil, nil, self), Form::Lettings::Pages::Outstanding.new(nil, nil, self),
Form::Lettings::Pages::OutstandingAmount.new(nil, nil, self), Form::Lettings::Pages::OutstandingAmount.new(nil, nil, self),
].compact ].compact

4
app/models/form/lettings/subsections/property_information.rb

@ -10,6 +10,8 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
@pages ||= [ @pages ||= [
uprn_questions, uprn_questions,
Form::Lettings::Pages::PropertyLocalAuthority.new(nil, nil, self), Form::Lettings::Pages::PropertyLocalAuthority.new(nil, nil, self),
Form::Lettings::Pages::MinRentValueCheck.new("local_authority_min_rent_value_check", nil, self, check_answers_card_number: nil),
Form::Lettings::Pages::MaxRentValueCheck.new("local_authority_max_rent_value_check", nil, self, check_answers_card_number: nil),
Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing.new(nil, nil, self), Form::Lettings::Pages::FirstTimePropertyLetAsSocialHousing.new(nil, nil, self),
Form::Lettings::Pages::PropertyLetType.new(nil, nil, self), Form::Lettings::Pages::PropertyLetType.new(nil, nil, self),
Form::Lettings::Pages::PropertyVacancyReasonNotFirstLet.new(nil, nil, self), Form::Lettings::Pages::PropertyVacancyReasonNotFirstLet.new(nil, nil, self),
@ -20,6 +22,8 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self), Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self),
Form::Lettings::Pages::PropertyWheelchairAccessible.new(nil, nil, self), Form::Lettings::Pages::PropertyWheelchairAccessible.new(nil, nil, self),
Form::Lettings::Pages::PropertyNumberOfBedrooms.new(nil, nil, self), Form::Lettings::Pages::PropertyNumberOfBedrooms.new(nil, nil, self),
Form::Lettings::Pages::MinRentValueCheck.new("beds_min_rent_value_check", nil, self, check_answers_card_number: 0),
Form::Lettings::Pages::MaxRentValueCheck.new("beds_max_rent_value_check", nil, self, check_answers_card_number: 0),
Form::Lettings::Pages::VoidDate.new(nil, nil, self), Form::Lettings::Pages::VoidDate.new(nil, nil, self),
Form::Lettings::Pages::VoidDateValueCheck.new(nil, nil, self), Form::Lettings::Pages::VoidDateValueCheck.new(nil, nil, self),
Form::Lettings::Pages::PropertyMajorRepairs.new(nil, nil, self), Form::Lettings::Pages::PropertyMajorRepairs.new(nil, nil, self),

8
app/models/form/lettings/subsections/setup.rb

@ -10,14 +10,22 @@ class Form::Lettings::Subsections::Setup < ::Form::Subsection
@pages ||= [ @pages ||= [
organisation_page, organisation_page,
stock_owner_page, stock_owner_page,
Form::Lettings::Pages::MinRentValueCheck.new("stock_owner_min_rent_value_check", nil, self),
Form::Lettings::Pages::MaxRentValueCheck.new("stock_owner_max_rent_value_check", nil, self),
managing_organisation_page, managing_organisation_page,
created_by_page, created_by_page,
Form::Lettings::Pages::NeedsType.new(nil, nil, self), Form::Lettings::Pages::NeedsType.new(nil, nil, self),
Form::Lettings::Pages::Scheme.new(nil, nil, self), Form::Lettings::Pages::Scheme.new(nil, nil, self),
Form::Lettings::Pages::Location.new(nil, nil, self), Form::Lettings::Pages::Location.new(nil, nil, self),
Form::Lettings::Pages::MinRentValueCheck.new("needs_type_min_rent_value_check", nil, self),
Form::Lettings::Pages::MaxRentValueCheck.new("needs_type_max_rent_value_check", nil, self),
Form::Lettings::Pages::Renewal.new(nil, nil, self), Form::Lettings::Pages::Renewal.new(nil, nil, self),
Form::Lettings::Pages::TenancyStartDate.new(nil, nil, self), Form::Lettings::Pages::TenancyStartDate.new(nil, nil, self),
Form::Lettings::Pages::MinRentValueCheck.new("start_date_min_rent_value_check", nil, self),
Form::Lettings::Pages::MaxRentValueCheck.new("start_date_max_rent_value_check", nil, self),
Form::Lettings::Pages::RentType.new(nil, nil, self), Form::Lettings::Pages::RentType.new(nil, nil, self),
Form::Lettings::Pages::MinRentValueCheck.new("rent_type_min_rent_value_check", nil, self),
Form::Lettings::Pages::MaxRentValueCheck.new("rent_type_max_rent_value_check", nil, self),
Form::Lettings::Pages::TenantCode.new(nil, nil, self), Form::Lettings::Pages::TenantCode.new(nil, nil, self),
Form::Lettings::Pages::PropertyReference.new(nil, nil, self), Form::Lettings::Pages::PropertyReference.new(nil, nil, self),
].compact ].compact

7
app/models/form/sales/questions/uprn_known.rb

@ -15,7 +15,12 @@ class Form::Sales::Questions::UprnKnown < ::Form::Question
"value" => "Not known", "value" => "Not known",
}, },
] ]
@hidden_in_check_answers = true @hidden_in_check_answers = {
"depends_on" => [
{ "uprn_known" => 0 },
{ "uprn_known" => 1 },
],
}
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

16
app/models/lettings_log.rb

@ -55,7 +55,7 @@ class LettingsLog < Log
scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) } scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) }
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze
OPTIONAL_FIELDS = %w[first_time_property_let_as_social_housing tenancycode propcode chcharge].freeze OPTIONAL_FIELDS = %w[rent_value_check first_time_property_let_as_social_housing tenancycode propcode chcharge].freeze
RENT_TYPE_MAPPING_LABELS = { 1 => "Social Rent", 2 => "Affordable Rent", 3 => "Intermediate Rent" }.freeze RENT_TYPE_MAPPING_LABELS = { 1 => "Social Rent", 2 => "Affordable Rent", 3 => "Intermediate Rent" }.freeze
HAS_BENEFITS_OPTIONS = [1, 6, 8, 7].freeze HAS_BENEFITS_OPTIONS = [1, 6, 8, 7].freeze
NUM_OF_WEEKS_FROM_PERIOD = { 2 => 26, 3 => 13, 4 => 12, 5 => 50, 6 => 49, 7 => 48, 8 => 47, 9 => 46, 1 => 52, 10 => 53 }.freeze NUM_OF_WEEKS_FROM_PERIOD = { 2 => 26, 3 => 13, 4 => 12, 5 => 50, 6 => 49, 7 => 48, 8 => 47, 9 => 46, 1 => 52, 10 => 53 }.freeze
@ -435,12 +435,22 @@ class LettingsLog < Log
end end
def soft_min_for_period def soft_min_for_period
soft_min = LaRentRange.find_by(start_year: collection_start_year, la:, beds: beds_for_la_rent_range, lettype:).soft_min soft_min = LaRentRange.find_by(
start_year: collection_start_year,
la:,
beds: beds_for_la_rent_range,
lettype:,
).soft_min
"#{soft_value_for_period(soft_min)} #{SUFFIX_FROM_PERIOD[period].presence || 'every week'}" "#{soft_value_for_period(soft_min)} #{SUFFIX_FROM_PERIOD[period].presence || 'every week'}"
end end
def soft_max_for_period def soft_max_for_period
soft_max = LaRentRange.find_by(start_year: collection_start_year, la:, beds: beds_for_la_rent_range, lettype:).soft_max soft_max = LaRentRange.find_by(
start_year: collection_start_year,
la:,
beds: beds_for_la_rent_range,
lettype:,
).soft_max
"#{soft_value_for_period(soft_max)} #{SUFFIX_FROM_PERIOD[period].presence || 'every week'}" "#{soft_value_for_period(soft_max)} #{SUFFIX_FROM_PERIOD[period].presence || 'every week'}"
end end

7
app/models/validations/soft_validations.rb

@ -40,7 +40,12 @@ module Validations::SoftValidations
def rent_in_soft_max_range? def rent_in_soft_max_range?
return unless brent && weekly_value(brent) && startdate return unless brent && weekly_value(brent) && startdate
rent_range = LaRentRange.find_by(start_year: collection_start_year, la:, beds: beds_for_la_rent_range, lettype: get_lettype) rent_range = LaRentRange.find_by(
start_year: collection_start_year,
la:,
beds: beds_for_la_rent_range,
lettype: get_lettype,
)
if beds.present? && rent_range.present? && beds > LaRentRange::MAX_BEDS if beds.present? && rent_range.present? && beds > LaRentRange::MAX_BEDS
weekly_value(brent) > rent_range.soft_max weekly_value(brent) > rent_range.soft_max
elsif rent_range.present? elsif rent_range.present?

4
spec/fixtures/files/lettings_logs_download.csv vendored

@ -1,2 +1,2 @@
id,status,created_at,updated_at,created_by_name,is_dpo,owning_organisation_name,managing_organisation_name,collection_start_year,needstype,renewal,startdate,rent_type_detail,irproduct_other,tenancycode,propcode,age1,sex1,ecstat1,hhmemb,relat2,age2,sex2,retirement_value_check,ecstat2,armedforces,leftreg,illness,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_h,is_previous_la_inferred,prevloc_label,prevloc,illness_type_1,illness_type_2,is_la_inferred,la_label,la,postcode_known,postcode_full,previous_la_known,wchair,preg_occ,cbl,earnings,incfreq,net_income_value_check,benefits,hb,period,brent,scharge,pscharge,supcharg,tcharge,offered,layear,ppostcode_full,mrcdate,declaration,ethnic,national,prevten,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,reservist,startertenancy,tenancylength,tenancy,rsnvac,unittype_gn,beds,waityear,reasonpref,chr,cap,reasonother,housingneeds_f,housingneeds_g,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,property_owner_organisation,property_manager_organisation,purchaser_code,reason,majorrepairs,hbrentshortfall,property_relet,incref,first_time_property_let_as_social_housing,unitletas,builtype,voiddate,renttype,lettype,totchild,totelder,totadult,net_income_known,nocharge,is_carehome,household_charge,referral,tshortfall,chcharge,ppcodenk,age1_known,age2_known,age3_known,age4_known,age5_known,age6_known,age7_known,age8_known,ethnic_group,letting_allocation_unknown,details_known_2,details_known_3,details_known_4,details_known_5,details_known_6,details_known_7,details_known_8,has_benefits,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat3,relat4,relat5,relat6,relat7,relat8,rent_value_check,old_form_id,lar,irproduct,old_id,joint,tshortfall_known,sheltered,pregnancy_value_check,hhtype,new_old,vacdays,major_repairs_date_value_check,void_date_value_check,housingneeds_type,housingneeds_other,unresolved,updated_by_id,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,carehome_charges_value_check,status_cache,unittype_sh,scheme_code,scheme_service_name,scheme_sensitive,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate id,status,created_at,updated_at,created_by_name,is_dpo,owning_organisation_name,managing_organisation_name,collection_start_year,rent_value_check,needstype,renewal,startdate,rent_type_detail,irproduct_other,tenancycode,propcode,age1,sex1,ecstat1,hhmemb,relat2,age2,sex2,retirement_value_check,ecstat2,armedforces,leftreg,illness,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_h,is_previous_la_inferred,prevloc_label,prevloc,illness_type_1,illness_type_2,is_la_inferred,la_label,la,postcode_known,postcode_full,previous_la_known,wchair,preg_occ,cbl,earnings,incfreq,net_income_value_check,benefits,hb,period,brent,scharge,pscharge,supcharg,tcharge,offered,layear,ppostcode_full,mrcdate,declaration,ethnic,national,prevten,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,reservist,startertenancy,tenancylength,tenancy,rsnvac,unittype_gn,beds,waityear,reasonpref,chr,cap,reasonother,housingneeds_f,housingneeds_g,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,property_owner_organisation,property_manager_organisation,purchaser_code,reason,majorrepairs,hbrentshortfall,property_relet,incref,first_time_property_let_as_social_housing,unitletas,builtype,voiddate,renttype,lettype,totchild,totelder,totadult,net_income_known,nocharge,is_carehome,household_charge,referral,tshortfall,chcharge,ppcodenk,age1_known,age2_known,age3_known,age4_known,age5_known,age6_known,age7_known,age8_known,ethnic_group,letting_allocation_unknown,details_known_2,details_known_3,details_known_4,details_known_5,details_known_6,details_known_7,details_known_8,has_benefits,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat3,relat4,relat5,relat6,relat7,relat8,old_form_id,lar,irproduct,old_id,joint,tshortfall_known,sheltered,pregnancy_value_check,hhtype,new_old,vacdays,major_repairs_date_value_check,void_date_value_check,housingneeds_type,housingneeds_other,unresolved,updated_by_id,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,carehome_charges_value_check,status_cache,unittype_sh,scheme_code,scheme_service_name,scheme_sensitive,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate
{id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,Danny Rojas,No,DLUHC,DLUHC,2021,Supported housing,,2 October 2021,London Affordable Rent,,,,,,,,,,,,,,,,,,,,No,,,,,No,Westminster,E09000033,,SE1 1TE,,No,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,8,0,0,0,,0,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,0,,,,,,,,,,,,,,,,,,,9,1,,,,,,,,,,,,,,,,not_started,6,{scheme_code},{scheme_service_name},{scheme_sensitive},Missing,No,DLUHC,{scheme_primary_client_group},,{scheme_secondary_client_group},{scheme_support_type},{scheme_intended_stay},2021-04-01 00:00:00 +0100,{location_code},SE1 1TE,Downing Street,20,Bungalow,Fitted with equipment and adaptations,Westminster,{location_startdate} {id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,Danny Rojas,No,DLUHC,DLUHC,2021,,Supported housing,,2 October 2021,London Affordable Rent,,,,,,,,,,,,,,,,,,,,No,,,,,No,Westminster,E09000033,,SE1 1TE,,No,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,8,0,0,0,,0,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,0,,,,,,,,,,,,,,,,,,9,1,,,,,,,,,,,,,,,,not_started,6,{scheme_code},{scheme_service_name},{scheme_sensitive},Missing,No,DLUHC,{scheme_primary_client_group},,{scheme_secondary_client_group},{scheme_support_type},{scheme_intended_stay},2021-04-01 00:00:00 +0100,{location_code},SE1 1TE,Downing Street,20,Bungalow,Fitted with equipment and adaptations,Westminster,{location_startdate}

1 id status created_at updated_at created_by_name is_dpo owning_organisation_name managing_organisation_name collection_start_year rent_value_check needstype renewal startdate rent_type_detail irproduct_other tenancycode propcode age1 sex1 ecstat1 hhmemb relat2 age2 sex2 retirement_value_check ecstat2 armedforces leftreg illness housingneeds_a housingneeds_b housingneeds_c housingneeds_h is_previous_la_inferred prevloc_label prevloc illness_type_1 illness_type_2 is_la_inferred la_label la postcode_known postcode_full previous_la_known wchair preg_occ cbl earnings incfreq net_income_value_check benefits hb period brent scharge pscharge supcharg tcharge offered layear ppostcode_full mrcdate declaration ethnic national prevten age3 sex3 ecstat3 age4 sex4 ecstat4 age5 sex5 ecstat5 age6 sex6 ecstat6 age7 sex7 ecstat7 age8 sex8 ecstat8 homeless underoccupation_benefitcap reservist startertenancy tenancylength tenancy rsnvac unittype_gn beds waityear reasonpref chr cap reasonother housingneeds_f housingneeds_g illness_type_3 illness_type_4 illness_type_8 illness_type_5 illness_type_6 illness_type_7 illness_type_9 illness_type_10 rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow tenancyother property_owner_organisation property_manager_organisation purchaser_code reason majorrepairs hbrentshortfall property_relet incref first_time_property_let_as_social_housing unitletas builtype voiddate renttype lettype totchild totelder totadult net_income_known nocharge is_carehome household_charge referral tshortfall chcharge ppcodenk age1_known age2_known age3_known age4_known age5_known age6_known age7_known age8_known ethnic_group letting_allocation_unknown details_known_2 details_known_3 details_known_4 details_known_5 details_known_6 details_known_7 details_known_8 has_benefits wrent wscharge wpschrge wsupchrg wtcharge wtshortfall refused housingneeds wchchrg newprop relat3 relat4 relat5 relat6 relat7 relat8 old_form_id lar irproduct old_id joint tshortfall_known sheltered pregnancy_value_check hhtype new_old vacdays major_repairs_date_value_check void_date_value_check housingneeds_type housingneeds_other unresolved updated_by_id uprn uprn_known uprn_confirmed address_line1 address_line2 town_or_city county carehome_charges_value_check status_cache unittype_sh scheme_code scheme_service_name scheme_sensitive scheme_type scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_admin_district location_startdate
2 {id} in_progress 2022-02-08 16:52:15 +0000 2022-02-08 16:52:15 +0000 Danny Rojas No DLUHC DLUHC 2021 Supported housing 2 October 2021 London Affordable Rent No No Westminster E09000033 SE1 1TE No 2 8 0 0 0 0 0 0 9 1 not_started 6 {scheme_code} {scheme_service_name} {scheme_sensitive} Missing No DLUHC {scheme_primary_client_group} {scheme_secondary_client_group} {scheme_support_type} {scheme_intended_stay} 2021-04-01 00:00:00 +0100 {location_code} SE1 1TE Downing Street 20 Bungalow Fitted with equipment and adaptations Westminster {location_startdate}

4
spec/fixtures/files/lettings_logs_download_codes_only.csv vendored

@ -1,2 +1,2 @@
id,status,created_at,updated_at,created_by_name,is_dpo,owning_organisation_name,managing_organisation_name,collection_start_year,needstype,renewal,startdate,rent_type_detail,irproduct_other,tenancycode,propcode,age1,sex1,ecstat1,hhmemb,relat2,age2,sex2,retirement_value_check,ecstat2,armedforces,leftreg,illness,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_h,is_previous_la_inferred,prevloc_label,prevloc,illness_type_1,illness_type_2,is_la_inferred,la_label,la,postcode_known,postcode_full,previous_la_known,wchair,preg_occ,cbl,earnings,incfreq,net_income_value_check,benefits,hb,period,brent,scharge,pscharge,supcharg,tcharge,offered,layear,ppostcode_full,mrcdate,declaration,ethnic,national,prevten,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,reservist,startertenancy,tenancylength,tenancy,rsnvac,unittype_gn,beds,waityear,reasonpref,chr,cap,reasonother,housingneeds_f,housingneeds_g,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,property_owner_organisation,property_manager_organisation,purchaser_code,reason,majorrepairs,hbrentshortfall,property_relet,incref,first_time_property_let_as_social_housing,unitletas,builtype,voiddate,renttype,lettype,totchild,totelder,totadult,net_income_known,nocharge,is_carehome,household_charge,referral,tshortfall,chcharge,ppcodenk,age1_known,age2_known,age3_known,age4_known,age5_known,age6_known,age7_known,age8_known,ethnic_group,letting_allocation_unknown,details_known_2,details_known_3,details_known_4,details_known_5,details_known_6,details_known_7,details_known_8,has_benefits,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat3,relat4,relat5,relat6,relat7,relat8,rent_value_check,old_form_id,lar,irproduct,old_id,joint,tshortfall_known,sheltered,pregnancy_value_check,hhtype,new_old,vacdays,major_repairs_date_value_check,void_date_value_check,housingneeds_type,housingneeds_other,unresolved,updated_by_id,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,carehome_charges_value_check,status_cache,unittype_sh,scheme_code,scheme_service_name,scheme_sensitive,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate id,status,created_at,updated_at,created_by_name,is_dpo,owning_organisation_name,managing_organisation_name,collection_start_year,rent_value_check,needstype,renewal,startdate,rent_type_detail,irproduct_other,tenancycode,propcode,age1,sex1,ecstat1,hhmemb,relat2,age2,sex2,retirement_value_check,ecstat2,armedforces,leftreg,illness,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_h,is_previous_la_inferred,prevloc_label,prevloc,illness_type_1,illness_type_2,is_la_inferred,la_label,la,postcode_known,postcode_full,previous_la_known,wchair,preg_occ,cbl,earnings,incfreq,net_income_value_check,benefits,hb,period,brent,scharge,pscharge,supcharg,tcharge,offered,layear,ppostcode_full,mrcdate,declaration,ethnic,national,prevten,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,reservist,startertenancy,tenancylength,tenancy,rsnvac,unittype_gn,beds,waityear,reasonpref,chr,cap,reasonother,housingneeds_f,housingneeds_g,illness_type_3,illness_type_4,illness_type_8,illness_type_5,illness_type_6,illness_type_7,illness_type_9,illness_type_10,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,tenancyother,property_owner_organisation,property_manager_organisation,purchaser_code,reason,majorrepairs,hbrentshortfall,property_relet,incref,first_time_property_let_as_social_housing,unitletas,builtype,voiddate,renttype,lettype,totchild,totelder,totadult,net_income_known,nocharge,is_carehome,household_charge,referral,tshortfall,chcharge,ppcodenk,age1_known,age2_known,age3_known,age4_known,age5_known,age6_known,age7_known,age8_known,ethnic_group,letting_allocation_unknown,details_known_2,details_known_3,details_known_4,details_known_5,details_known_6,details_known_7,details_known_8,has_benefits,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat3,relat4,relat5,relat6,relat7,relat8,old_form_id,lar,irproduct,old_id,joint,tshortfall_known,sheltered,pregnancy_value_check,hhtype,new_old,vacdays,major_repairs_date_value_check,void_date_value_check,housingneeds_type,housingneeds_other,unresolved,updated_by_id,uprn,uprn_known,uprn_confirmed,address_line1,address_line2,town_or_city,county,carehome_charges_value_check,status_cache,unittype_sh,scheme_code,scheme_service_name,scheme_sensitive,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_startdate
{id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,Danny Rojas,false,DLUHC,DLUHC,2021,2,,2 October 2021,2,,,,,,,,,,,,,,,,,,,,false,,,,,false,Westminster,E09000033,,SE1 1TE,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,8,0,0,0,,0,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,0,,,,,,,,,,,,,,,,,,,9,1,,,,,,,,,,,,,,,,not_started,6,{scheme_code},{scheme_service_name},{scheme_sensitive},0,1,DLUHC,{scheme_primary_client_group},,{scheme_secondary_client_group},{scheme_support_type},{scheme_intended_stay},2021-04-01 00:00:00 +0100,{location_code},SE1 1TE,Downing Street,20,6,A,Westminster,{location_startdate} {id},in_progress,2022-02-08 16:52:15 +0000,2022-02-08 16:52:15 +0000,Danny Rojas,false,DLUHC,DLUHC,2021,,2,,2 October 2021,2,,,,,,,,,,,,,,,,,,,,false,,,,,false,Westminster,E09000033,,SE1 1TE,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,8,0,0,0,,0,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,0,,,,,,,,,,,,,,,,,,9,1,,,,,,,,,,,,,,,,not_started,6,{scheme_code},{scheme_service_name},{scheme_sensitive},0,1,DLUHC,{scheme_primary_client_group},,{scheme_secondary_client_group},{scheme_support_type},{scheme_intended_stay},2021-04-01 00:00:00 +0100,{location_code},SE1 1TE,Downing Street,20,6,A,Westminster,{location_startdate}

1 id status created_at updated_at created_by_name is_dpo owning_organisation_name managing_organisation_name collection_start_year rent_value_check needstype renewal startdate rent_type_detail irproduct_other tenancycode propcode age1 sex1 ecstat1 hhmemb relat2 age2 sex2 retirement_value_check ecstat2 armedforces leftreg illness housingneeds_a housingneeds_b housingneeds_c housingneeds_h is_previous_la_inferred prevloc_label prevloc illness_type_1 illness_type_2 is_la_inferred la_label la postcode_known postcode_full previous_la_known wchair preg_occ cbl earnings incfreq net_income_value_check benefits hb period brent scharge pscharge supcharg tcharge offered layear ppostcode_full mrcdate declaration ethnic national prevten age3 sex3 ecstat3 age4 sex4 ecstat4 age5 sex5 ecstat5 age6 sex6 ecstat6 age7 sex7 ecstat7 age8 sex8 ecstat8 homeless underoccupation_benefitcap reservist startertenancy tenancylength tenancy rsnvac unittype_gn beds waityear reasonpref chr cap reasonother housingneeds_f housingneeds_g illness_type_3 illness_type_4 illness_type_8 illness_type_5 illness_type_6 illness_type_7 illness_type_9 illness_type_10 rp_homeless rp_insan_unsat rp_medwel rp_hardship rp_dontknow tenancyother property_owner_organisation property_manager_organisation purchaser_code reason majorrepairs hbrentshortfall property_relet incref first_time_property_let_as_social_housing unitletas builtype voiddate renttype lettype totchild totelder totadult net_income_known nocharge is_carehome household_charge referral tshortfall chcharge ppcodenk age1_known age2_known age3_known age4_known age5_known age6_known age7_known age8_known ethnic_group letting_allocation_unknown details_known_2 details_known_3 details_known_4 details_known_5 details_known_6 details_known_7 details_known_8 has_benefits wrent wscharge wpschrge wsupchrg wtcharge wtshortfall refused housingneeds wchchrg newprop relat3 relat4 relat5 relat6 relat7 relat8 old_form_id lar irproduct old_id joint tshortfall_known sheltered pregnancy_value_check hhtype new_old vacdays major_repairs_date_value_check void_date_value_check housingneeds_type housingneeds_other unresolved updated_by_id uprn uprn_known uprn_confirmed address_line1 address_line2 town_or_city county carehome_charges_value_check status_cache unittype_sh scheme_code scheme_service_name scheme_sensitive scheme_type scheme_registered_under_care_act scheme_owning_organisation_name scheme_primary_client_group scheme_has_other_client_group scheme_secondary_client_group scheme_support_type scheme_intended_stay scheme_created_at location_code location_postcode location_name location_units location_type_of_unit location_mobility_type location_admin_district location_startdate
2 {id} in_progress 2022-02-08 16:52:15 +0000 2022-02-08 16:52:15 +0000 Danny Rojas false DLUHC DLUHC 2021 2 2 October 2021 2 false false Westminster E09000033 SE1 1TE 2 2 8 0 0 0 0 0 0 9 1 not_started 6 {scheme_code} {scheme_service_name} {scheme_sensitive} 0 1 DLUHC {scheme_primary_client_group} {scheme_secondary_client_group} {scheme_support_type} {scheme_intended_stay} 2021-04-01 00:00:00 +0100 {location_code} SE1 1TE Downing Street 20 6 A Westminster {location_startdate}

2
spec/models/form/lettings/pages/max_rent_value_check_spec.rb

@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe Form::Lettings::Pages::MaxRentValueCheck, type: :model do RSpec.describe Form::Lettings::Pages::MaxRentValueCheck, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) } subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { "shared_ownership_deposit_value_check" } let(:page_id) { "max_rent_value_check" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:subsection) { instance_double(Form::Subsection) }

11
spec/models/form/lettings/pages/min_rent_value_check_spec.rb

@ -1,8 +1,9 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Lettings::Pages::MinRentValueCheck, type: :model do RSpec.describe Form::Lettings::Pages::MinRentValueCheck, type: :model do
subject(:page) { described_class.new(nil, page_definition, subsection) } subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { "min_rent_value_check" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:subsection) { instance_double(Form::Subsection) }
@ -41,8 +42,14 @@ RSpec.describe Form::Lettings::Pages::MinRentValueCheck, type: :model do
it "has the correct informative_text" do it "has the correct informative_text" do
expect(page.informative_text).to eq({ expect(page.informative_text).to eq({
"arguments" => [{ "arguments_for_key" => "soft_min_for_period", "i18n_template" => "soft_min_for_period", "key" => "field_formatted_as_currency" }],
"translation" => "soft_validations.rent.min_hint_text", "translation" => "soft_validations.rent.min_hint_text",
"arguments" => [
{
"key" => "field_formatted_as_currency",
"arguments_for_key" => "soft_min_for_period",
"i18n_template" => "soft_min_for_period",
},
],
}) })
end end
end end

16
spec/models/form/lettings/questions/uprn_known_spec.rb

@ -54,6 +54,20 @@ RSpec.describe Form::Lettings::Questions::UprnKnown, type: :model do
end end
it "has the correct hidden_in_check_answers" do it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(true) expect(question.hidden_in_check_answers).to eq({
"depends_on" => [
{ "uprn_known" => 0 },
{ "uprn_known" => 1 },
],
})
end
it "has the correct inferred_check_answers_value" do
expect(question.inferred_check_answers_value).to eq([
{
"condition" => { "uprn_known" => 0 },
"value" => "Not known",
},
])
end end
end end

4
spec/models/form/lettings/subsections/income_and_benefits_spec.rb

@ -30,8 +30,8 @@ RSpec.describe Form::Lettings::Subsections::IncomeAndBenefits, type: :model do
rent_bi_weekly rent_bi_weekly
rent_4_weekly rent_4_weekly
rent_monthly rent_monthly
min_rent_value_check brent_min_rent_value_check
max_rent_value_check brent_max_rent_value_check
outstanding outstanding
outstanding_amount outstanding_amount
], ],

8
spec/models/form/lettings/subsections/property_information_spec.rb

@ -20,6 +20,8 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
%w[ %w[
property_postcode property_postcode
property_local_authority property_local_authority
local_authority_min_rent_value_check
local_authority_max_rent_value_check
first_time_property_let_as_social_housing first_time_property_let_as_social_housing
property_let_type property_let_type
property_vacancy_reason_not_first_let property_vacancy_reason_not_first_let
@ -30,6 +32,8 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
property_building_type property_building_type
property_wheelchair_accessible property_wheelchair_accessible
property_number_of_bedrooms property_number_of_bedrooms
beds_min_rent_value_check
beds_max_rent_value_check
void_date void_date
void_date_value_check void_date_value_check
property_major_repairs property_major_repairs
@ -49,6 +53,8 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
uprn_confirmation uprn_confirmation
address address
property_local_authority property_local_authority
local_authority_min_rent_value_check
local_authority_max_rent_value_check
first_time_property_let_as_social_housing first_time_property_let_as_social_housing
property_let_type property_let_type
property_vacancy_reason_not_first_let property_vacancy_reason_not_first_let
@ -59,6 +65,8 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
property_building_type property_building_type
property_wheelchair_accessible property_wheelchair_accessible
property_number_of_bedrooms property_number_of_bedrooms
beds_min_rent_value_check
beds_max_rent_value_check
void_date void_date
void_date_value_check void_date_value_check
property_major_repairs property_major_repairs

16
spec/models/form/lettings/subsections/setup_spec.rb

@ -15,14 +15,22 @@ RSpec.describe Form::Lettings::Subsections::Setup, type: :model do
expect(setup.pages.map(&:id)).to eq( expect(setup.pages.map(&:id)).to eq(
%w[ %w[
stock_owner stock_owner
stock_owner_min_rent_value_check
stock_owner_max_rent_value_check
managing_organisation managing_organisation
created_by created_by
needs_type needs_type
scheme scheme
location location
needs_type_min_rent_value_check
needs_type_max_rent_value_check
renewal renewal
tenancy_start_date tenancy_start_date
start_date_min_rent_value_check
start_date_max_rent_value_check
rent_type rent_type
rent_type_min_rent_value_check
rent_type_max_rent_value_check
tenant_code tenant_code
property_reference property_reference
], ],
@ -42,14 +50,22 @@ RSpec.describe Form::Lettings::Subsections::Setup, type: :model do
expect(setup.pages.map(&:id)).to eq( expect(setup.pages.map(&:id)).to eq(
%w[ %w[
stock_owner stock_owner
stock_owner_min_rent_value_check
stock_owner_max_rent_value_check
managing_organisation managing_organisation
created_by created_by
needs_type needs_type
scheme scheme
location location
needs_type_min_rent_value_check
needs_type_max_rent_value_check
renewal renewal
tenancy_start_date tenancy_start_date
start_date_min_rent_value_check
start_date_max_rent_value_check
rent_type rent_type
rent_type_min_rent_value_check
rent_type_max_rent_value_check
tenant_code tenant_code
property_reference property_reference
], ],

16
spec/models/form/sales/questions/uprn_known_spec.rb

@ -54,6 +54,20 @@ RSpec.describe Form::Sales::Questions::UprnKnown, type: :model do
end end
it "has the correct hidden_in_check_answers" do it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(true) expect(question.hidden_in_check_answers).to eq({
"depends_on" => [
{ "uprn_known" => 0 },
{ "uprn_known" => 1 },
],
})
end
it "has the correct inferred_check_answers_value" do
expect(question.inferred_check_answers_value).to eq([
{
"condition" => { "uprn_known" => 0 },
"value" => "Not known",
},
])
end end
end end

8
spec/models/form_handler_spec.rb

@ -17,13 +17,13 @@ RSpec.describe FormHandler do
it "is able to load a current lettings form" do it "is able to load a current lettings form" do
form = form_handler.get_form("current_lettings") form = form_handler.get_form("current_lettings")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(46) expect(form.pages.count).to be_positive
end end
it "is able to load a next lettings form" do it "is able to load a next lettings form" do
form = form_handler.get_form("next_lettings") form = form_handler.get_form("next_lettings")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(13) expect(form.pages.count).to be_positive
end end
end end
@ -48,14 +48,14 @@ RSpec.describe FormHandler do
it "is able to load a current lettings form" do it "is able to load a current lettings form" do
form = form_handler.get_form("current_lettings") form = form_handler.get_form("current_lettings")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(13) expect(form.pages.count).to be_positive
expect(form.name).to eq("2022_2023_lettings") expect(form.name).to eq("2022_2023_lettings")
end end
it "is able to load a previous lettings form" do it "is able to load a previous lettings form" do
form = form_handler.get_form("previous_lettings") form = form_handler.get_form("previous_lettings")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(46) expect(form.pages.count).to be_positive
expect(form.name).to eq("2021_2022_lettings") expect(form.name).to eq("2021_2022_lettings")
end end

2
spec/models/lettings_log_spec.rb

@ -2310,6 +2310,7 @@ RSpec.describe LettingsLog do
it "returns optional fields" do it "returns optional fields" do
expect(lettings_log.optional_fields).to eq(%w[ expect(lettings_log.optional_fields).to eq(%w[
rent_value_check
first_time_property_let_as_social_housing first_time_property_let_as_social_housing
tenancycode tenancycode
propcode propcode
@ -2324,6 +2325,7 @@ RSpec.describe LettingsLog do
it "returns optional fields" do it "returns optional fields" do
expect(lettings_log.optional_fields).to eq(%w[ expect(lettings_log.optional_fields).to eq(%w[
rent_value_check
first_time_property_let_as_social_housing first_time_property_let_as_social_housing
tenancycode tenancycode
propcode propcode

2
spec/services/csv/lettings_log_csv_service_spec.rb

@ -20,6 +20,7 @@ RSpec.describe Csv::LettingsLogCsvService do
owning_organisation_name owning_organisation_name
managing_organisation_name managing_organisation_name
collection_start_year collection_start_year
rent_value_check
needstype needstype
renewal renewal
startdate startdate
@ -161,7 +162,6 @@ RSpec.describe Csv::LettingsLogCsvService do
pscharge pscharge
supcharg supcharg
tcharge tcharge
rent_value_check
hbrentshortfall hbrentshortfall
tshortfall_known tshortfall_known
tshortfall tshortfall

Loading…
Cancel
Save