Browse Source

CLDC-1698 Fix linting errors

pull/975/head
David May-Miller 3 years ago
parent
commit
44970dbe92
  1. 4
      app/models/validations/tenancy_validations.rb
  2. 32
      spec/models/validations/tenancy_validations_spec.rb

4
app/models/validations/tenancy_validations.rb

@ -17,7 +17,7 @@ module Validations::TenancyValidations
"validations.tenancy.length.shorthold",
min_tenancy_length: min_tenancy_length(record),
rent_type: rent_type_mapping(record)[record.rent_type],
needs_type: needs_type_mapping[record.needstype]
needs_type: needs_type_mapping[record.needstype],
),
},
{
@ -26,7 +26,7 @@ module Validations::TenancyValidations
"validations.tenancy.length.secure",
min_tenancy_length: min_tenancy_length(record),
rent_type: rent_type_mapping(record)[record.rent_type],
needs_type: needs_type_mapping[record.needstype]
needs_type: needs_type_mapping[record.needstype],
),
},
]

32
spec/models/validations/tenancy_validations_spec.rb

@ -21,12 +21,14 @@ RSpec.describe Validations::TenancyValidations do
end
context "when type of tenancy is assured shorthold" do
let(:expected_error) { I18n.t(
let(:expected_error) do
I18n.t(
"validations.tenancy.length.shorthold",
min_tenancy_length: 2,
needs_type: "General needs",
rent_type: "Affordable Rent"
) }
rent_type: "Affordable Rent",
)
end
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 type of tenancy is secure" do
let(:expected_error) { I18n.t(
let(:expected_error) do
I18n.t(
"validations.tenancy.length.secure",
min_tenancy_length: 2,
needs_type: "General needs",
rent_type: "Affordable Rent"
) }
rent_type: "Affordable Rent",
)
end
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) }
context "when type of tenancy is Secure - fixed term" do
let(:expected_error) { I18n.t(
let(:expected_error) do
I18n.t(
"validations.tenancy.length.secure",
min_tenancy_length: 2,
needs_type: "General needs",
rent_type: "Affordable Rent"
) }
rent_type: "Affordable Rent",
)
end
before { record.tenancy = 6 }
@ -167,12 +173,14 @@ RSpec.describe Validations::TenancyValidations do
end
context "when type of tenancy is Secure - lifetime" do
let(:expected_error) { I18n.t(
let(:expected_error) do
I18n.t(
"validations.tenancy.length.secure",
min_tenancy_length: 2,
needs_type: "General needs",
rent_type: "Affordable Rent"
) }
rent_type: "Affordable Rent",
)
end
before { record.tenancy = 7 }

Loading…
Cancel
Save