Browse Source

remove unnecessary method

pull/1368/head
Arthur Campbell 3 years ago
parent
commit
f712122f37
  1. 13
      app/models/form/lettings/subsections/property_information.rb
  2. 4
      app/models/lettings_log.rb
  3. 13
      spec/models/form/lettings/subsections/property_information_spec.rb

13
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

4
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

13
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

Loading…
Cancel
Save