Browse Source

Update tests

pull/2256/head
Kat 2 years ago
parent
commit
1bfb5281dc
  1. 2
      spec/models/form/sales/questions/age2_spec.rb
  2. 20
      spec/models/lettings_log_spec.rb
  3. 28
      spec/models/sales_log_spec.rb
  4. 2
      spec/models/validations/shared_validations_spec.rb
  5. 6
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

2
spec/models/form/sales/questions/age2_spec.rb

@ -53,7 +53,7 @@ RSpec.describe Form::Sales::Questions::Age2, type: :model do
end end
it "has the correct min" do it "has the correct min" do
expect(question.min).to eq(0) expect(question.min).to eq(16)
end end
it "has the correct max" do it "has the correct max" do

20
spec/models/lettings_log_spec.rb

@ -103,8 +103,24 @@ RSpec.describe LettingsLog do
expect(validator).to receive(:validate_irproduct_other) expect(validator).to receive(:validate_irproduct_other)
end end
it "validates other household member details" do it "validates partner count" do
expect(validator).to receive(:validate_household_number_of_other_members) expect(validator).to receive(:validate_partner_count)
end
it "validates person age matches economic status" do
expect(validator).to receive(:validate_person_age_matches_economic_status)
end
it "validates person age matches relationship" do
expect(validator).to receive(:validate_person_age_matches_relationship)
end
it "validates person age and relationship matches economic status" do
expect(validator).to receive(:validate_person_age_and_relationship_matches_economic_status)
end
it "validates child is over 12 years younger than lead tenant" do
expect(validator).to receive(:validate_child_12_years_younger)
end end
it "validates bedroom number" do it "validates bedroom number" do

28
spec/models/sales_log_spec.rb

@ -44,8 +44,24 @@ RSpec.describe SalesLog, type: :model do
sales_log.update(age1: 25) sales_log.update(age1: 25)
end end
it "validates other household member details" do it "validates partner count" do
expect(validator).to receive(:validate_household_number_of_other_members) expect(validator).to receive(:validate_partner_count)
end
it "validates person age matches economic status" do
expect(validator).to receive(:validate_person_age_matches_economic_status)
end
it "validates person age matches relationship" do
expect(validator).to receive(:validate_person_age_matches_relationship)
end
it "validates person age and relationship matches economic status" do
expect(validator).to receive(:validate_person_age_and_relationship_matches_economic_status)
end
it "validates child is over 12 years younger than lead tenant" do
expect(validator).to receive(:validate_child_12_years_younger)
end end
it "calls the form to clear any invalid answers" do it "calls the form to clear any invalid answers" do
@ -908,11 +924,11 @@ RSpec.describe SalesLog, type: :model do
relat5: "X", relat5: "X",
relat6: "P", relat6: "P",
income2: 0, income2: 0,
ecstat2: 9, ecstat2: 7,
ecstat3: 7, ecstat3: 9,
age1: 47, age1: 47,
age2: 14, age2: 17,
age3: 17, age3: 14,
age4: 88, age4: 88,
age5: 19, age5: 19,
age6: 46, age6: 46,

2
spec/models/validations/shared_validations_spec.rb

@ -82,7 +82,7 @@ RSpec.describe Validations::SharedValidations do
sales_log.jointpur = 1 sales_log.jointpur = 1
sales_log.age2 = 130 sales_log.age2 = 130
shared_validator.validate_numeric_min_max(sales_log) shared_validator.validate_numeric_min_max(sales_log)
expect(sales_log.errors["age2"].first).to eq("Buyer 2’s age must be between 0 and 110") expect(sales_log.errors["age2"].first).to eq("Buyer 2’s age must be between 16 and 110")
end end
end end
end end

6
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -150,7 +150,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
field_42: "42", field_42: "42",
field_48: "41", field_48: "41",
field_52: "20", field_52: "17",
field_56: "18", field_56: "18",
field_60: "16", field_60: "16",
field_64: "14", field_64: "14",
@ -171,7 +171,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
field_47: "P", field_47: "P",
field_51: "C", field_51: "C",
field_55: "X", field_55: "C",
field_59: "R", field_59: "R",
field_63: "C", field_63: "C",
field_67: "C", field_67: "C",
@ -179,7 +179,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
field_46: "1", field_46: "1",
field_50: "2", field_50: "2",
field_54: "6", field_54: "7",
field_58: "7", field_58: "7",
field_62: "8", field_62: "8",
field_66: "9", field_66: "9",

Loading…
Cancel
Save