From f712122f37c4442d30207f34ffee4a7ea32a96ea Mon Sep 17 00:00:00 2001 From: Arthur Campbell Date: Tue, 7 Mar 2023 09:41:08 +0000 Subject: [PATCH] remove unnecessary method --- .../lettings/subsections/property_information.rb | 13 +++++++++++-- app/models/lettings_log.rb | 4 ---- .../subsections/property_information_spec.rb | 13 +++++++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/models/form/lettings/subsections/property_information.rb b/app/models/form/lettings/subsections/property_information.rb index bc6dceba8..479a928a6 100644 --- a/app/models/form/lettings/subsections/property_information.rb +++ b/app/models/form/lettings/subsections/property_information.rb @@ -3,7 +3,16 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection super @id = "property_information" @label = "Property information" - @depends_on = [{ "non_location_setup_questions_completed?" => true, "supported_housing_and_renewal?" => false }] + @depends_on = [ + { + "non_location_setup_questions_completed?" => true, + "is_supported_housing?" => false, + }, + { + "non_location_setup_questions_completed?" => true, + "is_renewal?" => false, + }, + ] end def pages @@ -29,6 +38,6 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection end def displayed_in_tasklist?(log) - !log.supported_housing_and_renewal? + !log.is_supported_housing? || !log.is_renewal? end end diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 280818d92..36d81a537 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -213,10 +213,6 @@ class LettingsLog < Log needstype == 2 end - def supported_housing_and_renewal? - is_supported_housing? && is_renewal? - end - def has_hbrentshortfall? # 1: Yes hbrentshortfall == 1 diff --git a/spec/models/form/lettings/subsections/property_information_spec.rb b/spec/models/form/lettings/subsections/property_information_spec.rb index 74972a389..7d9665354 100644 --- a/spec/models/form/lettings/subsections/property_information_spec.rb +++ b/spec/models/form/lettings/subsections/property_information_spec.rb @@ -1,10 +1,8 @@ require "rails_helper" RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do - subject(:property_information) { described_class.new(subsection_id, subsection_definition, section) } + subject(:property_information) { described_class.new(nil, nil, section) } - let(:subsection_id) { nil } - let(:subsection_definition) { nil } let(:section) { instance_double(Form::Lettings::Sections::TenancyAndProperty) } it "has correct section" do @@ -44,6 +42,13 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do end it "has the correct depends_on" do - expect(property_information.depends_on).to eq([{ "non_location_setup_questions_completed?" => true, "supported_housing_and_renewal?" => false }]) + expect(property_information.depends_on).to eq([{ + "non_location_setup_questions_completed?" => true, + "is_supported_housing?" => false, + }, + { + "non_location_setup_questions_completed?" => true, + "is_renewal?" => false, + }]) end end