Browse Source

CLDC-4325: Fix lettings household validations spec

pull/3250/head
samyou-softwire 1 month ago
parent
commit
b4e5550058
  1. 13
      spec/models/validations/household_validations_spec.rb

13
spec/models/validations/household_validations_spec.rb

@ -6,7 +6,7 @@ RSpec.describe Validations::HouseholdValidations do
subject(:household_validator) { validator_class.new }
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)) }
describe "reasonable preference validations" do
@ -117,6 +117,10 @@ RSpec.describe Validations::HouseholdValidations do
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
it "can be permanently decanted from another property owned by this landlord" do
record.reason = 1
@ -166,6 +170,7 @@ RSpec.describe Validations::HouseholdValidations do
end
end
end
end
describe "armed forces validations" 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
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
it "can be internal transfer" do
record.homeless = 11
@ -490,8 +498,9 @@ RSpec.describe Validations::HouseholdValidations do
expect(record.errors["homeless"]).to be_empty
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) }
[

Loading…
Cancel
Save