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. 56
      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", "validations.tenancy.length.shorthold",
min_tenancy_length: min_tenancy_length(record), min_tenancy_length: min_tenancy_length(record),
rent_type: rent_type_mapping(record)[record.rent_type], 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", "validations.tenancy.length.secure",
min_tenancy_length: min_tenancy_length(record), min_tenancy_length: min_tenancy_length(record),
rent_type: rent_type_mapping(record)[record.rent_type], rent_type: rent_type_mapping(record)[record.rent_type],
needs_type: needs_type_mapping[record.needstype] needs_type: needs_type_mapping[record.needstype],
), ),
}, },
] ]

56
spec/models/validations/tenancy_validations_spec.rb

@ -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 }

Loading…
Cancel
Save