|
|
|
@ -171,88 +171,6 @@ RSpec.describe CaseLog do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when validating household members" do |
|
|
|
|
it "validate that persons aged over 70 must be retired" do |
|
|
|
|
expect { |
|
|
|
|
described_class.create!( |
|
|
|
|
age2: 71, |
|
|
|
|
ecstat2: "Full-time - 30 hours or more", |
|
|
|
|
owning_organisation:, |
|
|
|
|
managing_organisation:, |
|
|
|
|
) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validate that a male, retired persons must be over 65" do |
|
|
|
|
expect { |
|
|
|
|
described_class.create!( |
|
|
|
|
age2: 64, |
|
|
|
|
sex2: "Male", |
|
|
|
|
ecstat2: "Retired", |
|
|
|
|
owning_organisation:, |
|
|
|
|
managing_organisation:, |
|
|
|
|
) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validate that a female, retired persons must be over 60" do |
|
|
|
|
expect { |
|
|
|
|
described_class.create!( |
|
|
|
|
age2: 59, |
|
|
|
|
sex2: "Female", |
|
|
|
|
ecstat2: "Retired", |
|
|
|
|
owning_organisation:, |
|
|
|
|
managing_organisation:, |
|
|
|
|
) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validate that persons aged under 16 must be a child (economically speaking)" do |
|
|
|
|
expect { |
|
|
|
|
described_class.create!( |
|
|
|
|
age2: 15, |
|
|
|
|
ecstat2: "Full-time - 30 hours or more", |
|
|
|
|
owning_organisation:, |
|
|
|
|
managing_organisation:, |
|
|
|
|
) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validate that persons aged between 16 and 19 that are a child must be a full time student or economic status refused" do |
|
|
|
|
expect { |
|
|
|
|
described_class.create!( |
|
|
|
|
age2: 17, |
|
|
|
|
relat2: "Child - includes young adult and grown-up", |
|
|
|
|
ecstat2: "Full-time - 30 hours or more", |
|
|
|
|
owning_organisation:, |
|
|
|
|
managing_organisation:, |
|
|
|
|
) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validate that persons aged under 16 must be a child relationship" do |
|
|
|
|
expect { |
|
|
|
|
described_class.create!( |
|
|
|
|
age2: 15, |
|
|
|
|
relat2: "Partner", |
|
|
|
|
owning_organisation:, |
|
|
|
|
managing_organisation:, |
|
|
|
|
) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validate that no more than 1 partner relationship exists" do |
|
|
|
|
expect { |
|
|
|
|
described_class.create!( |
|
|
|
|
relat2: "Partner", |
|
|
|
|
relat3: "Partner", |
|
|
|
|
owning_organisation:, |
|
|
|
|
managing_organisation:, |
|
|
|
|
) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when validating other tenancy type" do |
|
|
|
|
it "must be provided if tenancy type was given as other" do |
|
|
|
|
expect { |
|
|
|
|