|
|
|
@ -6,7 +6,7 @@ RSpec.describe Validations::HouseholdValidations do |
|
|
|
subject(:household_validator) { validator_class.new } |
|
|
|
subject(:household_validator) { validator_class.new } |
|
|
|
|
|
|
|
|
|
|
|
let(:validator_class) { Class.new { include Validations::HouseholdValidations } } |
|
|
|
let(:validator_class) { Class.new { include Validations::HouseholdValidations } } |
|
|
|
let(:startdate) { Time.zone.now } |
|
|
|
let(:startdate) { current_collection_start_date } |
|
|
|
let(:record) { FactoryBot.build(:lettings_log, :setup_completed, startdate:, assigned_to: create(:user)) } |
|
|
|
let(:record) { FactoryBot.build(:lettings_log, :setup_completed, startdate:, assigned_to: create(:user)) } |
|
|
|
|
|
|
|
|
|
|
|
describe "reasonable preference validations" do |
|
|
|
describe "reasonable preference validations" do |
|
|
|
@ -117,6 +117,10 @@ RSpec.describe Validations::HouseholdValidations do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when 2025", metadata: { year: 25 } do |
|
|
|
|
|
|
|
# post 2025 we don't ask referral and referral_type any more |
|
|
|
|
|
|
|
let(:startdate) { collection_start_date_for_year(2025) } |
|
|
|
|
|
|
|
|
|
|
|
context "when referral is not internal transfer" do |
|
|
|
context "when referral is not internal transfer" do |
|
|
|
it "can be permanently decanted from another property owned by this landlord" do |
|
|
|
it "can be permanently decanted from another property owned by this landlord" do |
|
|
|
record.reason = 1 |
|
|
|
record.reason = 1 |
|
|
|
@ -166,6 +170,7 @@ RSpec.describe Validations::HouseholdValidations do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "armed forces validations" do |
|
|
|
describe "armed forces validations" do |
|
|
|
context "when the tenant or partner was and is not a member of the armed forces" do |
|
|
|
context "when the tenant or partner was and is not a member of the armed forces" do |
|
|
|
@ -445,6 +450,9 @@ RSpec.describe Validations::HouseholdValidations do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "referral validations" do |
|
|
|
describe "referral validations" do |
|
|
|
|
|
|
|
context "when start year is 2025", metadata: { year: 25 } do |
|
|
|
|
|
|
|
let(:startdate) { collection_start_date_for_year(2025) } |
|
|
|
|
|
|
|
|
|
|
|
context "when homelessness is assessed" do |
|
|
|
context "when homelessness is assessed" do |
|
|
|
it "can be internal transfer" do |
|
|
|
it "can be internal transfer" do |
|
|
|
record.homeless = 11 |
|
|
|
record.homeless = 11 |
|
|
|
@ -490,8 +498,9 @@ RSpec.describe Validations::HouseholdValidations do |
|
|
|
expect(record.errors["homeless"]).to be_empty |
|
|
|
expect(record.errors["homeless"]).to be_empty |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when start year is 2026" do |
|
|
|
context "when start year is 2026", metadata: { year: 26 } do |
|
|
|
let(:startdate) { collection_start_date_for_year(2026) } |
|
|
|
let(:startdate) { collection_start_date_for_year(2026) } |
|
|
|
|
|
|
|
|
|
|
|
[ |
|
|
|
[ |
|
|
|
|