|
|
@ -21,12 +21,14 @@ RSpec.describe Validations::TenancyValidations do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when type of tenancy is assured shorthold" do |
|
|
|
context "when type of tenancy is assured shorthold" do |
|
|
|
let(:expected_error) { I18n.t( |
|
|
|
let(:expected_error) do |
|
|
|
"validations.tenancy.length.shorthold", |
|
|
|
I18n.t( |
|
|
|
min_tenancy_length: 2, |
|
|
|
"validations.tenancy.length.shorthold", |
|
|
|
needs_type: "General needs", |
|
|
|
min_tenancy_length: 2, |
|
|
|
rent_type: "Affordable Rent" |
|
|
|
needs_type: "General needs", |
|
|
|
) } |
|
|
|
rent_type: "Affordable Rent", |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before { record.tenancy = 4 } |
|
|
|
before { record.tenancy = 4 } |
|
|
|
|
|
|
|
|
|
|
@ -69,12 +71,14 @@ RSpec.describe Validations::TenancyValidations do |
|
|
|
|
|
|
|
|
|
|
|
context "when the collection start year is before 2022" do |
|
|
|
context "when the collection start year is before 2022" do |
|
|
|
context "when type of tenancy is secure" do |
|
|
|
context "when type of tenancy is secure" do |
|
|
|
let(:expected_error) { I18n.t( |
|
|
|
let(:expected_error) do |
|
|
|
"validations.tenancy.length.secure", |
|
|
|
I18n.t( |
|
|
|
min_tenancy_length: 2, |
|
|
|
"validations.tenancy.length.secure", |
|
|
|
needs_type: "General needs", |
|
|
|
min_tenancy_length: 2, |
|
|
|
rent_type: "Affordable Rent" |
|
|
|
needs_type: "General needs", |
|
|
|
) } |
|
|
|
rent_type: "Affordable Rent", |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before { record.tenancy = 1 } |
|
|
|
before { record.tenancy = 1 } |
|
|
|
|
|
|
|
|
|
|
@ -120,12 +124,14 @@ RSpec.describe Validations::TenancyValidations do |
|
|
|
let(:record) { FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 5, 1), needstype: 1, rent_type: 1) } |
|
|
|
let(:record) { FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 5, 1), needstype: 1, rent_type: 1) } |
|
|
|
|
|
|
|
|
|
|
|
context "when type of tenancy is Secure - fixed term" do |
|
|
|
context "when type of tenancy is Secure - fixed term" do |
|
|
|
let(:expected_error) { I18n.t( |
|
|
|
let(:expected_error) do |
|
|
|
"validations.tenancy.length.secure", |
|
|
|
I18n.t( |
|
|
|
min_tenancy_length: 2, |
|
|
|
"validations.tenancy.length.secure", |
|
|
|
needs_type: "General needs", |
|
|
|
min_tenancy_length: 2, |
|
|
|
rent_type: "Affordable Rent" |
|
|
|
needs_type: "General needs", |
|
|
|
) } |
|
|
|
rent_type: "Affordable Rent", |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before { record.tenancy = 6 } |
|
|
|
before { record.tenancy = 6 } |
|
|
|
|
|
|
|
|
|
|
@ -167,12 +173,14 @@ RSpec.describe Validations::TenancyValidations do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when type of tenancy is Secure - lifetime" do |
|
|
|
context "when type of tenancy is Secure - lifetime" do |
|
|
|
let(:expected_error) { I18n.t( |
|
|
|
let(:expected_error) do |
|
|
|
"validations.tenancy.length.secure", |
|
|
|
I18n.t( |
|
|
|
min_tenancy_length: 2, |
|
|
|
"validations.tenancy.length.secure", |
|
|
|
needs_type: "General needs", |
|
|
|
min_tenancy_length: 2, |
|
|
|
rent_type: "Affordable Rent" |
|
|
|
needs_type: "General needs", |
|
|
|
) } |
|
|
|
rent_type: "Affordable Rent", |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before { record.tenancy = 7 } |
|
|
|
before { record.tenancy = 7 } |
|
|
|
|
|
|
|
|
|
|
|