Browse Source

fixup! CLDC-4136: Hide question on UI flow

update tests to account
pull/3136/head
Samuel Young 1 month ago
parent
commit
0fdcd85d31
  1. 60
      spec/models/form/lettings/subsections/property_information_spec.rb

60
spec/models/form/lettings/subsections/property_information_spec.rb

@ -15,22 +15,23 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false) allow(form).to receive(:start_year_2025_or_later?).and_return(true)
allow(form).to receive(:start_year_2026_or_later?).and_return(true)
end end
context "when 2023" do context "when 2024" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.utc(2024, 4, 8) }
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false) allow(form).to receive(:start_year_2025_or_later?).and_return(false)
allow(form).to receive(:start_year_2026_or_later?).and_return(false)
end end
it "has correct pages" do it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq( expect(property_information.pages.map(&:id)).to eq(
%w[ %w[
uprn address_search
uprn_confirmation
address address
property_local_authority property_local_authority
local_authority_rent_value_check local_authority_rent_value_check
@ -38,7 +39,6 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
property_let_type property_let_type
property_vacancy_reason_not_first_let property_vacancy_reason_not_first_let
property_vacancy_reason_first_let property_vacancy_reason_first_let
property_number_of_times_relet
property_unit_type property_unit_type
property_building_type property_building_type
property_wheelchair_accessible property_wheelchair_accessible
@ -51,27 +51,36 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
], ],
) )
end end
context "when it is supported housing and a renewal" do
let(:log) { FactoryBot.build(:lettings_log, needstype: 2, renewal: 1) }
it "is not displayed in tasklist" do
expect(property_information.displayed_in_tasklist?(log)).to eq(false)
end
end
end end
context "when 2024" do context "when 2025" do
let(:start_date) { Time.utc(2024, 2, 8) } let(:start_date) { Time.utc(2025, 4, 8) }
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false) allow(form).to receive(:start_year_2025_or_later?).and_return(true)
allow(form).to receive(:start_year_2026_or_later?).and_return(false)
end end
it "has correct pages" do it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq( expect(property_information.pages.map(&:id)).to eq(
%w[ %w[
address_search
address
property_local_authority
local_authority_rent_value_check
first_time_property_let_as_social_housing first_time_property_let_as_social_housing
property_let_type property_let_type
property_vacancy_reason_not_first_let property_vacancy_reason_not_first_let
property_vacancy_reason_first_let property_vacancy_reason_first_let
address_search
address
property_local_authority
local_authority_rent_value_check
property_unit_type property_unit_type
property_building_type property_building_type
property_wheelchair_accessible property_wheelchair_accessible
@ -81,6 +90,7 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
void_date_value_check void_date_value_check
property_major_repairs property_major_repairs
property_major_repairs_value_check property_major_repairs_value_check
sheltered_accommodation
], ],
) )
end end
@ -88,23 +98,24 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
context "when it is supported housing and a renewal" do context "when it is supported housing and a renewal" do
let(:log) { FactoryBot.build(:lettings_log, needstype: 2, renewal: 1) } let(:log) { FactoryBot.build(:lettings_log, needstype: 2, renewal: 1) }
it "is not displayed in tasklist" do it "is displayed in tasklist" do
expect(property_information.displayed_in_tasklist?(log)).to eq(false) expect(property_information.displayed_in_tasklist?(log)).to eq(true)
end end
end end
end end
context "when 2025" do context "when 2026" do
let(:start_date) { Time.utc(2025, 2, 8) } let(:start_date) { Time.utc(2026, 4, 8) }
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(true) allow(form).to receive(:start_year_2025_or_later?).and_return(true)
allow(form).to receive(:start_year_2026_or_later?).and_return(true)
end end
it "has correct pages" do it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq( expect(property_information.pages.map(&:id)).to eq(
%w[ %w[
first_time_property_let_as_social_housing first_time_property_let_as_social_housing
property_let_type property_let_type
property_vacancy_reason_not_first_let property_vacancy_reason_not_first_let
@ -114,7 +125,6 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
property_local_authority property_local_authority
local_authority_rent_value_check local_authority_rent_value_check
property_unit_type property_unit_type
property_building_type
property_wheelchair_accessible property_wheelchair_accessible
property_number_of_bedrooms property_number_of_bedrooms
beds_rent_value_check beds_rent_value_check
@ -124,15 +134,7 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
property_major_repairs_value_check property_major_repairs_value_check
sheltered_accommodation sheltered_accommodation
], ],
) )
end
context "when it is supported housing and a renewal" do
let(:log) { FactoryBot.build(:lettings_log, needstype: 2, renewal: 1) }
it "is displayed in tasklist" do
expect(property_information.displayed_in_tasklist?(log)).to eq(true)
end
end end
end end
end end

Loading…
Cancel
Save