From 44970dbe92b3656fda39b55fb61f05b041e61847 Mon Sep 17 00:00:00 2001 From: David May-Miller Date: Tue, 8 Nov 2022 15:35:14 +0000 Subject: [PATCH] CLDC-1698 Fix linting errors --- app/models/validations/tenancy_validations.rb | 4 +- .../validations/tenancy_validations_spec.rb | 56 +++++++++++-------- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/app/models/validations/tenancy_validations.rb b/app/models/validations/tenancy_validations.rb index d2fe27b63..c2dc96b01 100644 --- a/app/models/validations/tenancy_validations.rb +++ b/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], ), }, ] diff --git a/spec/models/validations/tenancy_validations_spec.rb b/spec/models/validations/tenancy_validations_spec.rb index f8e10aaf9..c88cc86a0 100644 --- a/spec/models/validations/tenancy_validations_spec.rb +++ b/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( - "validations.tenancy.length.shorthold", - min_tenancy_length: 2, - needs_type: "General needs", - rent_type: "Affordable Rent" - ) } + let(:expected_error) do + I18n.t( + "validations.tenancy.length.shorthold", + min_tenancy_length: 2, + needs_type: "General needs", + 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( - "validations.tenancy.length.secure", - min_tenancy_length: 2, - needs_type: "General needs", - rent_type: "Affordable Rent" - ) } + let(:expected_error) do + I18n.t( + "validations.tenancy.length.secure", + min_tenancy_length: 2, + needs_type: "General needs", + 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( - "validations.tenancy.length.secure", - min_tenancy_length: 2, - needs_type: "General needs", - rent_type: "Affordable Rent" - ) } + let(:expected_error) do + I18n.t( + "validations.tenancy.length.secure", + min_tenancy_length: 2, + needs_type: "General needs", + 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( - "validations.tenancy.length.secure", - min_tenancy_length: 2, - needs_type: "General needs", - rent_type: "Affordable Rent" - ) } + let(:expected_error) do + I18n.t( + "validations.tenancy.length.secure", + min_tenancy_length: 2, + needs_type: "General needs", + rent_type: "Affordable Rent", + ) + end before { record.tenancy = 7 }