Browse Source

Merge branch 'main' into CLDC-1917-allow-23/24-form

# Conflicts:
#	db/schema.rb
CLDC-1917-allow-23/24-form
natdeanlewissoftwire 2 years ago
parent
commit
0595b32254
  1. 15
      app/models/form/sales/pages/buyer2_ethnic_background_arab.rb
  2. 15
      app/models/form/sales/pages/buyer2_ethnic_background_asian.rb
  3. 15
      app/models/form/sales/pages/buyer2_ethnic_background_black.rb
  4. 15
      app/models/form/sales/pages/buyer2_ethnic_background_mixed.rb
  5. 15
      app/models/form/sales/pages/buyer2_ethnic_background_white.rb
  6. 22
      app/models/form/sales/pages/buyer2_ethnic_group.rb
  7. 16
      app/models/form/sales/questions/buyer2_ethnic_background_arab.rb
  8. 19
      app/models/form/sales/questions/buyer2_ethnic_background_asian.rb
  9. 17
      app/models/form/sales/questions/buyer2_ethnic_background_black.rb
  10. 18
      app/models/form/sales/questions/buyer2_ethnic_background_mixed.rb
  11. 18
      app/models/form/sales/questions/buyer2_ethnic_background_white.rb
  12. 27
      app/models/form/sales/questions/buyer2_ethnic_group.rb
  13. 14
      app/models/form/sales/subsections/household_characteristics.rb
  14. 49
      app/services/bulk_upload/lettings/row_parser.rb
  15. 2
      app/services/exports/lettings_log_export_constants.rb
  16. 2
      app/services/exports/lettings_log_export_service.rb
  17. 6
      config/locales/en.yml
  18. 1185
      config/sale_range_data/2023.csv
  19. 8
      db/migrate/20230210143120_add_ethnic_fields_for_buyer2.rb
  20. 6
      db/schema.rb
  21. 2
      spec/fixtures/exports/general_needs_log.csv
  22. 2
      spec/fixtures/exports/general_needs_log.xml
  23. 2
      spec/fixtures/exports/supported_housing_logs.xml
  24. 33
      spec/models/form/sales/pages/buyer2_ethnic_background_arab_spec.rb
  25. 33
      spec/models/form/sales/pages/buyer2_ethnic_background_asian_spec.rb
  26. 33
      spec/models/form/sales/pages/buyer2_ethnic_background_black_spec.rb
  27. 33
      spec/models/form/sales/pages/buyer2_ethnic_background_mixed_spec.rb
  28. 33
      spec/models/form/sales/pages/buyer2_ethnic_background_white_spec.rb
  29. 42
      spec/models/form/sales/pages/buyer2_ethnic_group_spec.rb
  30. 48
      spec/models/form/sales/questions/buyer2_ethnic_background_arab_spec.rb
  31. 51
      spec/models/form/sales/questions/buyer2_ethnic_background_asian_spec.rb
  32. 49
      spec/models/form/sales/questions/buyer2_ethnic_background_black_spec.rb
  33. 50
      spec/models/form/sales/questions/buyer2_ethnic_background_mixed_spec.rb
  34. 50
      spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb
  35. 62
      spec/models/form/sales/questions/buyer2_ethnic_group_spec.rb
  36. 218
      spec/models/form/sales/subsections/household_characteristics_spec.rb
  37. 97
      spec/services/bulk_upload/lettings/row_parser_spec.rb

15
app/models/form/sales/pages/buyer2_ethnic_background_arab.rb

@ -0,0 +1,15 @@
class Form::Sales::Pages::Buyer2EthnicBackgroundArab < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_ethnic_background_arab"
@depends_on = [{
"ethnic_group2" => 4,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Buyer2EthnicBackgroundArab.new(nil, nil, self),
]
end
end

15
app/models/form/sales/pages/buyer2_ethnic_background_asian.rb

@ -0,0 +1,15 @@
class Form::Sales::Pages::Buyer2EthnicBackgroundAsian < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_ethnic_background_asian"
@depends_on = [{
"ethnic_group2" => 2,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Buyer2EthnicBackgroundAsian.new(nil, nil, self),
]
end
end

15
app/models/form/sales/pages/buyer2_ethnic_background_black.rb

@ -0,0 +1,15 @@
class Form::Sales::Pages::Buyer2EthnicBackgroundBlack < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_ethnic_background_black"
@depends_on = [{
"ethnic_group2" => 3,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Buyer2EthnicBackgroundBlack.new(nil, nil, self),
]
end
end

15
app/models/form/sales/pages/buyer2_ethnic_background_mixed.rb

@ -0,0 +1,15 @@
class Form::Sales::Pages::Buyer2EthnicBackgroundMixed < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_ethnic_background_mixed"
@depends_on = [{
"ethnic_group2" => 1,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Buyer2EthnicBackgroundMixed.new(nil, nil, self),
]
end
end

15
app/models/form/sales/pages/buyer2_ethnic_background_white.rb

@ -0,0 +1,15 @@
class Form::Sales::Pages::Buyer2EthnicBackgroundWhite < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_ethnic_background_white"
@depends_on = [{
"ethnic_group2" => 0,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Buyer2EthnicBackgroundWhite.new(nil, nil, self),
]
end
end

22
app/models/form/sales/pages/buyer2_ethnic_group.rb

@ -0,0 +1,22 @@
class Form::Sales::Pages::Buyer2EthnicGroup < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "buyer_2_ethnic_group"
@depends_on = [
{
"jointpur" => 1,
"privacynotice" => 1,
},
{
"jointpur" => 1,
"noint" => 1,
},
]
end
def questions
@questions ||= [
Form::Sales::Questions::Buyer2EthnicGroup.new(nil, nil, self),
]
end
end

16
app/models/form/sales/questions/buyer2_ethnic_background_arab.rb

@ -0,0 +1,16 @@
class Form::Sales::Questions::Buyer2EthnicBackgroundArab < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background"
@header = "Which of the following best describes the buyer 2’s Arab background?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {
"19" => { "value" => "Arab" },
"16" => { "value" => "Other ethnic group" },
}.freeze
end

19
app/models/form/sales/questions/buyer2_ethnic_background_asian.rb

@ -0,0 +1,19 @@
class Form::Sales::Questions::Buyer2EthnicBackgroundAsian < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background"
@header = "Which of the following best describes the buyer 2’s Asian or Asian British background?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {
"10" => { "value" => "Bangladeshi" },
"15" => { "value" => "Chinese" },
"8" => { "value" => "Indian" },
"9" => { "value" => "Pakistani" },
"11" => { "value" => "Any other Asian or Asian British background" },
}.freeze
end

17
app/models/form/sales/questions/buyer2_ethnic_background_black.rb

@ -0,0 +1,17 @@
class Form::Sales::Questions::Buyer2EthnicBackgroundBlack < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background"
@header = "Which of the following best describes the buyer 2’s Black, African, Caribbean or Black British background?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {
"13" => { "value" => "African" },
"12" => { "value" => "Caribbean" },
"14" => { "value" => "Any other Black, African or Caribbean background" },
}.freeze
end

18
app/models/form/sales/questions/buyer2_ethnic_background_mixed.rb

@ -0,0 +1,18 @@
class Form::Sales::Questions::Buyer2EthnicBackgroundMixed < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background"
@header = "Which of the following best describes the buyer 2’s Mixed or Multiple ethnic groups background?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {
"4" => { "value" => "White and Black Caribbean" },
"5" => { "value" => "White and Black African" },
"6" => { "value" => "White and Asian" },
"7" => { "value" => "Any other Mixed or Multiple ethnic background" },
}.freeze
end

18
app/models/form/sales/questions/buyer2_ethnic_background_white.rb

@ -0,0 +1,18 @@
class Form::Sales::Questions::Buyer2EthnicBackgroundWhite < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnicbuy2"
@check_answer_label = "Buyer 2’s ethnic background"
@header = "Which of the following best describes the buyer 2’s White background?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"2" => { "value" => "Irish" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"3" => { "value" => "Any other White background" },
}.freeze
end

27
app/models/form/sales/questions/buyer2_ethnic_group.rb

@ -0,0 +1,27 @@
class Form::Sales::Questions::Buyer2EthnicGroup < ::Form::Question
def initialize(id, hsh, page)
super
@id = "ethnic_group2"
@check_answer_label = "Buyer 2’s ethnic group"
@header = "What is buyer 2’s ethnic group?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@inferred_check_answers_value = [{
"condition" => {
"ethnic_group2" => 17,
},
"value" => "Prefers not to say",
}]
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {
"0" => { "value" => "White" },
"1" => { "value" => "Mixed or Multiple ethnic groups" },
"2" => { "value" => "Asian or Asian British" },
"3" => { "value" => "Black, African, Caribbean or Black British" },
"4" => { "value" => "Arab or other ethnic group" },
"divider" => { "value" => true },
"17" => { "value" => "Buyer 1 prefers not to say" },
}.freeze
end

14
app/models/form/sales/subsections/household_characteristics.rb

@ -32,6 +32,7 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection
Form::Sales::Pages::RetirementValueCheck.new("age_2_buyer_retirement_value_check", nil, self, person_index: 2),
Form::Sales::Pages::GenderIdentity2.new(nil, nil, self),
Form::Sales::Pages::RetirementValueCheck.new("gender_2_buyer_retirement_value_check", nil, self, person_index: 2),
ethnic_pages_for_buyer_2,
Form::Sales::Pages::Buyer2WorkingSituation.new(nil, nil, self),
Form::Sales::Pages::RetirementValueCheck.new("working_situation_2_buyer_retirement_value_check", nil, self, person_index: 2),
Form::Sales::Pages::Buyer2LiveInProperty.new(nil, nil, self),
@ -68,6 +69,17 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection
Form::Sales::Pages::RetirementValueCheck.new("gender_5_retirement_value_check", nil, self, person_index: 5),
Form::Sales::Pages::PersonWorkingSituation.new("person_5_working_situation", nil, self, person_index: 5),
Form::Sales::Pages::RetirementValueCheck.new("working_situation_5_retirement_value_check", nil, self, person_index: 5),
]
].flatten.compact
end
def ethnic_pages_for_buyer_2
if form.start_date.year >= 2023
[Form::Sales::Pages::Buyer2EthnicGroup.new(nil, nil, self),
Form::Sales::Pages::Buyer2EthnicBackgroundBlack.new(nil, nil, self),
Form::Sales::Pages::Buyer2EthnicBackgroundAsian.new(nil, nil, self),
Form::Sales::Pages::Buyer2EthnicBackgroundArab.new(nil, nil, self),
Form::Sales::Pages::Buyer2EthnicBackgroundMixed.new(nil, nil, self),
Form::Sales::Pages::Buyer2EthnicBackgroundWhite.new(nil, nil, self)]
end
end
end

49
app/services/bulk_upload/lettings/row_parser.rb

@ -150,6 +150,10 @@ class BulkUpload::Lettings::RowParser
validate :validate_cannot_be_la_referral_if_general_needs
validate :validate_leaving_reason_for_renewal
validate :validate_lettings_type_matches_bulk_upload
validate :validate_only_one_housing_needs_type
validate :validate_no_disabled_needs_conjunction
validate :validate_dont_know_disabled_needs_conjunction
validate :validate_no_and_dont_know_disabled_needs_conjunction
def valid?
errors.clear
@ -178,6 +182,33 @@ class BulkUpload::Lettings::RowParser
private
def validate_no_and_dont_know_disabled_needs_conjunction
if field_59 == 1 && field_60 == 1
errors.add(:field_59, I18n.t("validations.household.housingneeds.no_and_dont_know_disabled_needs_conjunction"))
errors.add(:field_60, I18n.t("validations.household.housingneeds.no_and_dont_know_disabled_needs_conjunction"))
end
end
def validate_dont_know_disabled_needs_conjunction
if field_60 == 1 && [field_55, field_56, field_57, field_58].compact.count.positive?
errors.add(:field_60, I18n.t("validations.household.housingneeds.dont_know_disabled_needs_conjunction"))
end
end
def validate_no_disabled_needs_conjunction
if field_59 == 1 && [field_55, field_56, field_57, field_58].compact.count.positive?
errors.add(:field_59, I18n.t("validations.household.housingneeds.no_disabled_needs_conjunction"))
end
end
def validate_only_one_housing_needs_type
if [field_55, field_56, field_57].compact.count.positive?
errors.add(:field_55, I18n.t("validations.household.housingneeds_type.only_one_option_permitted"))
errors.add(:field_56, I18n.t("validations.household.housingneeds_type.only_one_option_permitted"))
errors.add(:field_57, I18n.t("validations.household.housingneeds_type.only_one_option_permitted"))
end
end
def validate_lettings_type_matches_bulk_upload
if [1, 3, 5, 7, 9, 11].include?(field_1) && !bulk_upload.general_needs?
errors.add(:field_1, I18n.t("validations.setup.lettype.supported_housing_mismatch"))
@ -552,6 +583,8 @@ private
attributes["preg_occ"] = field_47
attributes["housingneeds"] = housingneeds
attributes["housingneeds_type"] = housingneeds_type
attributes["housingneeds_other"] = housingneeds_other
attributes["illness"] = field_118
@ -808,7 +841,7 @@ private
def housingneeds
if field_59 == 1
1
2
elsif field_60 == 1
3
else
@ -816,6 +849,20 @@ private
end
end
def housingneeds_type
if field_55 == 1
0
elsif field_56 == 1
1
elsif field_57 == 1
2
end
end
def housingneeds_other
return 1 if field_58 == 1
end
def ethnic_group_from_ethnic
return nil if field_43.blank?

2
app/services/exports/lettings_log_export_constants.rb

@ -30,7 +30,7 @@ module Exports::LettingsLogExportConstants
"confidential",
"earnings",
"ethnic",
"form",
"formid",
"has_benefits",
"hb",
"hbrentshortfall",

2
app/services/exports/lettings_log_export_service.rb

@ -152,7 +152,7 @@ module Exports
def apply_cds_transformation(lettings_log, export_mode)
attribute_hash = lettings_log.attributes_before_type_cast
attribute_hash["form"] = attribute_hash["old_form_id"] || (attribute_hash["id"] + LOG_ID_OFFSET)
attribute_hash["formid"] = attribute_hash["old_form_id"] || (attribute_hash["id"] + LOG_ID_OFFSET)
# We can't have a variable number of columns in CSV
unless export_mode == EXPORT_MODE[:csv]

6
config/locales/en.yml

@ -349,6 +349,12 @@ en:
must_be_child: "Answer must be ‘child’ if the person is aged 16-19 and a student"
housingneeds_a:
one_or_two_choices: "You can only select one option or ‘other disabled access needs’ plus ‘wheelchair-accessible housing’, ‘wheelchair access to essential rooms’ or ‘level access housing’"
housingneeds_type:
only_one_option_permitted: "Only one disabled access need: fully wheelchair-accessible housing, wheelchair access to essential rooms or level access housing, can be selected"
housingneeds:
no_disabled_needs_conjunction: "No disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs"
dont_know_disabled_needs_conjunction: "Don’t know disabled access needs can’t be selected if you have selected fully wheelchair-accessible housing, wheelchair access to essential rooms, level access housing or other disabled access needs"
no_and_dont_know_disabled_needs_conjunction: "No disabled access needs and don’t know disabled access needs cannot be selected together"
prevten:
non_temp_accommodation: "Answer cannot be non-temporary accommodation as this is a re-let to a tenant who occupied the same property as temporary accommodation"
over_20_foster_care: "Answer cannot be a children’s home or foster care as the lead tenant is 20 or older"

1185
config/sale_range_data/2023.csv

File diff suppressed because it is too large Load Diff

8
db/migrate/20230210143120_add_ethnic_fields_for_buyer2.rb

@ -0,0 +1,8 @@
class AddEthnicFieldsForBuyer2 < ActiveRecord::Migration[7.0]
def change
change_table :sales_logs, bulk: true do |t|
t.column :ethnic_group2, :integer
t.column :ethnicbuy2, :integer
end
end
end

6
db/schema.rb

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_02_10_122037) do
ActiveRecord::Schema[7.0].define(version: 2023_02_10_143120) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -524,8 +524,10 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_10_122037) do
t.integer "details_known_5"
t.integer "details_known_6"
t.integer "saledate_check"
t.integer "prevshared"
t.integer "staircasesale"
t.integer "prevshared"
t.integer "ethnic_group2"
t.integer "ethnicbuy2"
t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id"
t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id"
t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id"

2
spec/fixtures/exports/general_needs_log.csv vendored

@ -1,2 +1,2 @@
status,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,hhmemb,age2,sex2,ecstat2,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,leftreg,reservist,illness,preg_occ,startertenancy,tenancylength,tenancy,ppostcode_full,rsnvac,unittype_gn,beds,offered,wchair,earnings,incfreq,benefits,period,layear,waityear,postcode_full,reasonpref,cbl,chr,cap,reasonother,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,illness_type_1,illness_type_2,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,irproduct_other,reason,propcode,la,prevloc,hb,hbrentshortfall,mrcdate,incref,startdate,armedforces,unitletas,builtype,voiddate,renttype,needstype,lettype,totchild,totelder,totadult,nocharge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,ppcodenk,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,sheltered,hhtype,new_old,vacdays,form,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate
status,tenancycode,age1,sex1,ethnic,national,prevten,ecstat1,hhmemb,age2,sex2,ecstat2,age3,sex3,ecstat3,age4,sex4,ecstat4,age5,sex5,ecstat5,age6,sex6,ecstat6,age7,sex7,ecstat7,age8,sex8,ecstat8,homeless,underoccupation_benefitcap,leftreg,reservist,illness,preg_occ,startertenancy,tenancylength,tenancy,ppostcode_full,rsnvac,unittype_gn,beds,offered,wchair,earnings,incfreq,benefits,period,layear,waityear,postcode_full,reasonpref,cbl,chr,cap,reasonother,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,illness_type_1,illness_type_2,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,irproduct_other,reason,propcode,la,prevloc,hb,hbrentshortfall,mrcdate,incref,startdate,armedforces,unitletas,builtype,voiddate,renttype,needstype,lettype,totchild,totelder,totadult,nocharge,referral,brent,scharge,pscharge,supcharg,tcharge,tshortfall,chcharge,ppcodenk,has_benefits,renewal,wrent,wscharge,wpschrge,wsupchrg,wtcharge,wtshortfall,refused,housingneeds,wchchrg,newprop,relat2,relat3,relat4,relat5,relat6,relat7,relat8,lar,irproduct,joint,sheltered,hhtype,new_old,vacdays,formid,owningorgid,owningorgname,hcnum,maningorgid,maningorgname,manhcnum,createddate,uploaddate
2,BZ737,35,F,2,4,6,0,2,32,M,6,,,,,,,,,,,,,,,,,,,1,4,1,1,1,2,1,5,1,SE2 6RT,6,7,3,2,1,68,1,1,2,2,1,NW1 5TY,1,2,1,2,,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,,,4,123,E09000003,E07000105,6,1,2020-05-05T10:36:49+01:00,0,2022-02-02T10:36:49+00:00,1,2,1,2019-11-03T00:00:00+00:00,2,1,7,0,0,2,0,2,200.0,50.0,40.0,35.0,325.0,12.0,,1,1,0,100.0,25.0,20.0,17.5,162.5,6.0,0,1,,2,P,,,,,,,,,,,4,2,638,{id},{owning_org_id},DLUHC,1234,{managing_org_id},DLUHC,1234,2022-02-08T16:52:15+00:00,2022-02-08T16:52:15+00:00

1 status tenancycode age1 sex1 ethnic national prevten ecstat1 hhmemb age2 sex2 ecstat2 age3 sex3 ecstat3 age4 sex4 ecstat4 age5 sex5 ecstat5 age6 sex6 ecstat6 age7 sex7 ecstat7 age8 sex8 ecstat8 homeless underoccupation_benefitcap leftreg reservist illness preg_occ startertenancy tenancylength tenancy ppostcode_full rsnvac unittype_gn beds offered wchair earnings incfreq benefits period layear waityear postcode_full reasonpref cbl chr cap reasonother housingneeds_a housingneeds_b housingneeds_c housingneeds_f housingneeds_g housingneeds_h illness_type_1 illness_type_2 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 irproduct_other reason propcode la prevloc hb hbrentshortfall mrcdate incref startdate armedforces unitletas builtype voiddate renttype needstype lettype totchild totelder totadult nocharge referral brent scharge pscharge supcharg tcharge tshortfall chcharge ppcodenk has_benefits renewal wrent wscharge wpschrge wsupchrg wtcharge wtshortfall refused housingneeds wchchrg newprop relat2 relat3 relat4 relat5 relat6 relat7 relat8 lar irproduct joint sheltered hhtype new_old vacdays form formid owningorgid owningorgname hcnum maningorgid maningorgname manhcnum createddate uploaddate
2 2 BZ737 35 F 2 4 6 0 2 32 M 6 1 4 1 1 1 2 1 5 1 SE2 6RT 6 7 3 2 1 68 1 1 2 2 1 NW1 5TY 1 2 1 2 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 4 123 E09000003 E07000105 6 1 2020-05-05T10:36:49+01:00 0 2022-02-02T10:36:49+00:00 1 2 1 2019-11-03T00:00:00+00:00 2 1 7 0 0 2 0 2 200.0 50.0 40.0 35.0 325.0 12.0 1 1 0 100.0 25.0 20.0 17.5 162.5 6.0 0 1 2 P 4 2 638 {id} {id} {owning_org_id} DLUHC 1234 {managing_org_id} DLUHC 1234 2022-02-08T16:52:15+00:00 2022-02-08T16:52:15+00:00

2
spec/fixtures/exports/general_needs_log.xml vendored

@ -135,7 +135,7 @@
<hhtype>4</hhtype>
<new_old>2</new_old>
<vacdays>638</vacdays>
<form>{id}</form>
<formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid>
<owningorgname>DLUHC</owningorgname>
<hcnum>1234</hcnum>

2
spec/fixtures/exports/supported_housing_logs.xml vendored

@ -134,7 +134,7 @@
<hhtype>4</hhtype>
<new_old>2</new_old>
<vacdays>638</vacdays>
<form>{id}</form>
<formid>{id}</formid>
<owningorgid>{owning_org_id}</owningorgid>
<owningorgname>DLUHC</owningorgname>
<hcnum>1234</hcnum>

33
spec/models/form/sales/pages/buyer2_ethnic_background_arab_spec.rb

@ -0,0 +1,33 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundArab, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2])
end
it "has the correct id" do
expect(page.id).to eq("buyer_2_ethnic_background_arab")
end
it "has the correct header" do
expect(page.header).to be_nil
end
it "has the correct description" do
expect(page.description).to be_nil
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "ethnic_group2" => 4 }])
end
end

33
spec/models/form/sales/pages/buyer2_ethnic_background_asian_spec.rb

@ -0,0 +1,33 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundAsian, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2])
end
it "has the correct id" do
expect(page.id).to eq("buyer_2_ethnic_background_asian")
end
it "has the correct header" do
expect(page.header).to be_nil
end
it "has the correct description" do
expect(page.description).to be_nil
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "ethnic_group2" => 2 }])
end
end

33
spec/models/form/sales/pages/buyer2_ethnic_background_black_spec.rb

@ -0,0 +1,33 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundBlack, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2])
end
it "has the correct id" do
expect(page.id).to eq("buyer_2_ethnic_background_black")
end
it "has the correct header" do
expect(page.header).to be_nil
end
it "has the correct description" do
expect(page.description).to be_nil
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "ethnic_group2" => 3 }])
end
end

33
spec/models/form/sales/pages/buyer2_ethnic_background_mixed_spec.rb

@ -0,0 +1,33 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundMixed, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2])
end
it "has the correct id" do
expect(page.id).to eq("buyer_2_ethnic_background_mixed")
end
it "has the correct header" do
expect(page.header).to be_nil
end
it "has the correct description" do
expect(page.description).to be_nil
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "ethnic_group2" => 1 }])
end
end

33
spec/models/form/sales/pages/buyer2_ethnic_background_white_spec.rb

@ -0,0 +1,33 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Buyer2EthnicBackgroundWhite, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[ethnicbuy2])
end
it "has the correct id" do
expect(page.id).to eq("buyer_2_ethnic_background_white")
end
it "has the correct header" do
expect(page.header).to be_nil
end
it "has the correct description" do
expect(page.description).to be_nil
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "ethnic_group2" => 0 }])
end
end

42
spec/models/form/sales/pages/buyer2_ethnic_group_spec.rb

@ -0,0 +1,42 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Buyer2EthnicGroup, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
end
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[ethnic_group2])
end
it "has the correct id" do
expect(page.id).to eq("buyer_2_ethnic_group")
end
it "has the correct header" do
expect(page.header).to be_nil
end
it "has the correct description" do
expect(page.description).to be_nil
end
it "has correct depends_on" do
expect(page.depends_on).to eq([
{
"jointpur" => 1,
"privacynotice" => 1,
},
{
"jointpur" => 1,
"noint" => 1,
},
])
end
end

48
spec/models/form/sales/questions/buyer2_ethnic_background_arab_spec.rb

@ -0,0 +1,48 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundArab, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("ethnicbuy2")
end
it "has the correct header" do
expect(question.header).to eq("Which of the following best describes the buyer 2’s Arab background?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint_text" do
expect(question.hint_text).to be nil
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"16" => { "value" => "Other ethnic group" },
"19" => { "value" => "Arab" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

51
spec/models/form/sales/questions/buyer2_ethnic_background_asian_spec.rb

@ -0,0 +1,51 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundAsian, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("ethnicbuy2")
end
it "has the correct header" do
expect(question.header).to eq("Which of the following best describes the buyer 2’s Asian or Asian British background?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint_text" do
expect(question.hint_text).to be nil
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"10" => { "value" => "Bangladeshi" },
"11" => { "value" => "Any other Asian or Asian British background" },
"15" => { "value" => "Chinese" },
"8" => { "value" => "Indian" },
"9" => { "value" => "Pakistani" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

49
spec/models/form/sales/questions/buyer2_ethnic_background_black_spec.rb

@ -0,0 +1,49 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundBlack, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("ethnicbuy2")
end
it "has the correct header" do
expect(question.header).to eq("Which of the following best describes the buyer 2’s Black, African, Caribbean or Black British background?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint_text" do
expect(question.hint_text).to be nil
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"12" => { "value" => "Caribbean" },
"13" => { "value" => "African" },
"14" => { "value" => "Any other Black, African or Caribbean background" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

50
spec/models/form/sales/questions/buyer2_ethnic_background_mixed_spec.rb

@ -0,0 +1,50 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundMixed, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("ethnicbuy2")
end
it "has the correct header" do
expect(question.header).to eq("Which of the following best describes the buyer 2’s Mixed or Multiple ethnic groups background?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint_text" do
expect(question.hint_text).to be nil
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"4" => { "value" => "White and Black Caribbean" },
"5" => { "value" => "White and Black African" },
"6" => { "value" => "White and Asian" },
"7" => { "value" => "Any other Mixed or Multiple ethnic background" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

50
spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb

@ -0,0 +1,50 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundWhite, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("ethnicbuy2")
end
it "has the correct header" do
expect(question.header).to eq("Which of the following best describes the buyer 2’s White background?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer 2’s ethnic background")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint_text" do
expect(question.hint_text).to be nil
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"1" => { "value" => "English, Welsh, Northern Irish, Scottish or British" },
"18" => { "value" => "Gypsy or Irish Traveller" },
"2" => { "value" => "Irish" },
"3" => { "value" => "Any other White background" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

62
spec/models/form/sales/questions/buyer2_ethnic_group_spec.rb

@ -0,0 +1,62 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Buyer2EthnicGroup, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("ethnic_group2")
end
it "has the correct header" do
expect(question.header).to eq("What is buyer 2’s ethnic group?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer 2’s ethnic group")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint_text" do
expect(question.hint_text).to be nil
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"0" => { "value" => "White" },
"1" => { "value" => "Mixed or Multiple ethnic groups" },
"17" => { "value" => "Buyer 1 prefers not to say" },
"2" => { "value" => "Asian or Asian British" },
"3" => { "value" => "Black, African, Caribbean or Black British" },
"4" => { "value" => "Arab or other ethnic group" },
"divider" => { "value" => true },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
it "has the correct inferred_check_answers_value" do
expect(question.inferred_check_answers_value).to eq([{
"condition" => {
"ethnic_group2" => 17,
},
"value" => "Prefers not to say",
}])
end
end

218
spec/models/form/sales/subsections/household_characteristics_spec.rb

@ -6,76 +6,164 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model
let(:subsection_id) { nil }
let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Sales::Sections::Household) }
let(:form) { instance_double(Form) }
it "has correct section" do
expect(household_characteristics.section).to eq(section)
end
it "has correct pages" do
expect(household_characteristics.pages.map(&:id)).to eq(
%w[
buyer_interview
privacy_notice
buyer_1_age
age_1_retirement_value_check
age_1_old_persons_shared_ownership_value_check
buyer_1_gender_identity
gender_1_retirement_value_check
buyer_1_ethnic_group
buyer_1_ethnic_background_black
buyer_1_ethnic_background_asian
buyer_1_ethnic_background_arab
buyer_1_ethnic_background_mixed
buyer_1_ethnic_background_white
buyer_1_nationality
buyer_1_working_situation
working_situation_1_retirement_value_check
working_situation_buyer_1_income_value_check
buyer_1_live_in_property
buyer_2_relationship_to_buyer_1
buyer_2_age
age_2_old_persons_shared_ownership_value_check
age_2_buyer_retirement_value_check
buyer_2_gender_identity
gender_2_buyer_retirement_value_check
buyer_2_working_situation
working_situation_2_buyer_retirement_value_check
buyer_2_live_in_property
number_of_others_in_property
person_2_known
person_2_relationship_to_buyer_1
person_2_age
age_2_retirement_value_check
person_2_gender_identity
gender_2_retirement_value_check
person_2_working_situation
working_situation_2_retirement_value_check
person_3_known
person_3_relationship_to_buyer_1
person_3_age
age_3_retirement_value_check
person_3_gender_identity
gender_3_retirement_value_check
person_3_working_situation
working_situation_3_retirement_value_check
person_4_known
person_4_relationship_to_buyer_1
person_4_age
age_4_retirement_value_check
person_4_gender_identity
gender_4_retirement_value_check
person_4_working_situation
working_situation_4_retirement_value_check
person_5_known
person_5_relationship_to_buyer_1
person_5_age
age_5_retirement_value_check
person_5_gender_identity
gender_5_retirement_value_check
person_5_working_situation
working_situation_5_retirement_value_check
],
)
context "with 2022/23 form" do
before do
allow(form).to receive(:start_date).and_return(Time.zone.local(2022, 4, 1))
allow(section).to receive(:form).and_return(form)
end
it "has correct pages" do
expect(household_characteristics.pages.map(&:id)).to eq(
%w[
buyer_interview
privacy_notice
buyer_1_age
age_1_retirement_value_check
age_1_old_persons_shared_ownership_value_check
buyer_1_gender_identity
gender_1_retirement_value_check
buyer_1_ethnic_group
buyer_1_ethnic_background_black
buyer_1_ethnic_background_asian
buyer_1_ethnic_background_arab
buyer_1_ethnic_background_mixed
buyer_1_ethnic_background_white
buyer_1_nationality
buyer_1_working_situation
working_situation_1_retirement_value_check
working_situation_buyer_1_income_value_check
buyer_1_live_in_property
buyer_2_relationship_to_buyer_1
buyer_2_age
age_2_old_persons_shared_ownership_value_check
age_2_buyer_retirement_value_check
buyer_2_gender_identity
gender_2_buyer_retirement_value_check
buyer_2_working_situation
working_situation_2_buyer_retirement_value_check
buyer_2_live_in_property
number_of_others_in_property
person_2_known
person_2_relationship_to_buyer_1
person_2_age
age_2_retirement_value_check
person_2_gender_identity
gender_2_retirement_value_check
person_2_working_situation
working_situation_2_retirement_value_check
person_3_known
person_3_relationship_to_buyer_1
person_3_age
age_3_retirement_value_check
person_3_gender_identity
gender_3_retirement_value_check
person_3_working_situation
working_situation_3_retirement_value_check
person_4_known
person_4_relationship_to_buyer_1
person_4_age
age_4_retirement_value_check
person_4_gender_identity
gender_4_retirement_value_check
person_4_working_situation
working_situation_4_retirement_value_check
person_5_known
person_5_relationship_to_buyer_1
person_5_age
age_5_retirement_value_check
person_5_gender_identity
gender_5_retirement_value_check
person_5_working_situation
working_situation_5_retirement_value_check
],
)
end
end
context "with 2023/24 form" do
before do
allow(form).to receive(:start_date).and_return(Time.zone.local(2023, 4, 1))
allow(section).to receive(:form).and_return(form)
end
it "has correct pages" do
expect(household_characteristics.pages.map(&:id)).to eq(
%w[
buyer_interview
privacy_notice
buyer_1_age
age_1_retirement_value_check
age_1_old_persons_shared_ownership_value_check
buyer_1_gender_identity
gender_1_retirement_value_check
buyer_1_ethnic_group
buyer_1_ethnic_background_black
buyer_1_ethnic_background_asian
buyer_1_ethnic_background_arab
buyer_1_ethnic_background_mixed
buyer_1_ethnic_background_white
buyer_1_nationality
buyer_1_working_situation
working_situation_1_retirement_value_check
working_situation_buyer_1_income_value_check
buyer_1_live_in_property
buyer_2_relationship_to_buyer_1
buyer_2_age
age_2_old_persons_shared_ownership_value_check
age_2_buyer_retirement_value_check
buyer_2_gender_identity
gender_2_buyer_retirement_value_check
buyer_2_ethnic_group
buyer_2_ethnic_background_black
buyer_2_ethnic_background_asian
buyer_2_ethnic_background_arab
buyer_2_ethnic_background_mixed
buyer_2_ethnic_background_white
buyer_2_working_situation
working_situation_2_buyer_retirement_value_check
buyer_2_live_in_property
number_of_others_in_property
person_2_known
person_2_relationship_to_buyer_1
person_2_age
age_2_retirement_value_check
person_2_gender_identity
gender_2_retirement_value_check
person_2_working_situation
working_situation_2_retirement_value_check
person_3_known
person_3_relationship_to_buyer_1
person_3_age
age_3_retirement_value_check
person_3_gender_identity
gender_3_retirement_value_check
person_3_working_situation
working_situation_3_retirement_value_check
person_4_known
person_4_relationship_to_buyer_1
person_4_age
age_4_retirement_value_check
person_4_gender_identity
gender_4_retirement_value_check
person_4_working_situation
working_situation_4_retirement_value_check
person_5_known
person_5_relationship_to_buyer_1
person_5_age
age_5_retirement_value_check
person_5_gender_identity
gender_5_retirement_value_check
person_5_working_situation
working_situation_5_retirement_value_check
],
)
end
end
it "has the correct id" do

97
spec/services/bulk_upload/lettings/row_parser_spec.rb

@ -344,6 +344,49 @@ RSpec.describe BulkUpload::Lettings::RowParser do
end
end
describe "#field_55, #field_56, #field_57" do
context "when more than one item selected" do
let(:attributes) { { bulk_upload:, field_55: "1", field_56: "1" } }
it "is not permitted" do
expect(parser.errors[:field_55]).to be_present
expect(parser.errors[:field_56]).to be_present
expect(parser.errors[:field_57]).to be_present
end
end
end
describe "#field_59" do
context "when 1 and another disability field selected" do
let(:attributes) { { bulk_upload:, field_59: "1", field_58: "1" } }
it "is not permitted" do
expect(parser.errors[:field_59]).to be_present
end
end
end
describe "#field_60" do
context "when 1 and another disability field selected" do
let(:attributes) { { bulk_upload:, field_60: "1", field_58: "1" } }
it "is not permitted" do
expect(parser.errors[:field_60]).to be_present
end
end
end
describe "#field_59, #field_60" do
context "when both 1" do
let(:attributes) { { bulk_upload:, field_59: "1", field_60: "1" } }
it "is not permitted" do
expect(parser.errors[:field_59]).to be_present
expect(parser.errors[:field_60]).to be_present
end
end
end
describe "#field_78" do # referral
context "when 3 ie PRP nominated by LA and owning org is LA" do
let(:attributes) { { bulk_upload:, field_78: "3", field_111: owning_org.old_visible_id } }
@ -894,6 +937,60 @@ RSpec.describe BulkUpload::Lettings::RowParser do
end
end
end
describe "#housingneeds" do
context "when no disabled needs" do
let(:attributes) { { bulk_upload:, field_59: "1" } }
it "sets to 2" do
expect(parser.log.housingneeds).to eq(2)
end
end
context "when dont know about disabled needs" do
let(:attributes) { { bulk_upload:, field_60: "1" } }
it "sets to 3" do
expect(parser.log.housingneeds).to eq(3)
end
end
end
describe "#housingneeds_type" do
context "when field_55 is 1" do
let(:attributes) { { bulk_upload:, field_55: "1" } }
it "set to 0" do
expect(parser.log.housingneeds_type).to eq(0)
end
end
context "when field_56 is 1" do
let(:attributes) { { bulk_upload:, field_56: "1" } }
it "set to 1" do
expect(parser.log.housingneeds_type).to eq(1)
end
end
context "when field_57 is 1" do
let(:attributes) { { bulk_upload:, field_57: "1" } }
it "set to 2" do
expect(parser.log.housingneeds_type).to eq(2)
end
end
end
describe "#housingneeds_other" do
context "when field_58 is 1" do
let(:attributes) { { bulk_upload:, field_58: "1" } }
it "sets to 1" do
expect(parser.log.housingneeds_other).to eq(1)
end
end
end
end
describe "#start_date" do

Loading…
Cancel
Save