Browse Source

feat: add extra test, typos

pull/1682/head
natdeanlewissoftwire 3 years ago
parent
commit
a1466e0001
  1. 14
      spec/models/validations/household_validations_spec.rb
  2. 10
      spec/models/validations/sales/household_validations_spec.rb

14
spec/models/validations/household_validations_spec.rb

@ -363,7 +363,7 @@ RSpec.describe Validations::HouseholdValidations do
end
end
it "does not add an error for a person aged 16-19 who is a student but not a child of the buyer" do
it "does not add an error for a person aged 16-19 who is a student but not a child of the lead tenant" do
record.age2 = 18
record.ecstat2 = "7"
record.relat2 = "P"
@ -373,7 +373,17 @@ RSpec.describe Validations::HouseholdValidations do
expect(record.errors["age2"]).to be_empty
end
it "adds errors for a person who is a child of the buyer and a student but not aged 16-19" do
it "does not add an error for a person not aged 16-19 who is a student but not a child of the lead tenant" do
record.age2 = 20
record.ecstat2 = "7"
record.relat2 = "P"
household_validator.validate_household_number_of_other_members(record)
expect(record.errors["relat2"]).to be_empty
expect(record.errors["ecstat2"]).to be_empty
expect(record.errors["age2"]).to be_empty
end
it "adds errors for a person who is a child of the lead tenant and a student but not aged 16-19" do
record.age2 = 14
record.ecstat2 = "7"
record.relat2 = "C"

10
spec/models/validations/sales/household_validations_spec.rb

@ -117,6 +117,16 @@ RSpec.describe Validations::Sales::HouseholdValidations do
expect(record.errors["age2"]).to be_empty
end
it "does not add an error for a person not aged 16-19 who is a student but not a child of the buyer" do
record.age2 = 20
record.ecstat2 = "7"
record.relat2 = "P"
household_validator.validate_household_number_of_other_members(record)
expect(record.errors["relat2"]).to be_empty
expect(record.errors["ecstat2"]).to be_empty
expect(record.errors["age2"]).to be_empty
end
it "adds errors for a person aged 16-19 who is a child of the buyer but not a student" do
record.age2 = 17
record.ecstat2 = "1"

Loading…
Cancel
Save