From 98d351bd4d5fa9ba60c10cff33e86f13c7ab1c23 Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 21 Feb 2024 13:53:47 +0000 Subject: [PATCH] Stub form start date in question tests --- spec/models/form/lettings/questions/address_line1_spec.rb | 2 +- spec/models/form/lettings/questions/age1_known_spec.rb | 2 +- spec/models/form/lettings/questions/beds_spec.rb | 2 +- spec/models/form/lettings/questions/county_spec.rb | 2 +- spec/models/form/lettings/questions/created_by_id_spec.rb | 2 +- spec/models/form/lettings/questions/declaration_spec.rb | 2 +- spec/models/form/lettings/questions/ethnic_white_spec.rb | 2 +- .../first_time_property_let_as_social_housing_spec.rb | 2 +- spec/models/form/lettings/questions/gender_identity1_spec.rb | 2 +- spec/models/form/lettings/questions/hb_spec.rb | 2 +- .../models/form/lettings/questions/housingneeds_other_spec.rb | 2 +- spec/models/form/lettings/questions/irproduct_other_spec.rb | 2 +- spec/models/form/lettings/questions/is_carehome_spec.rb | 2 +- spec/models/form/lettings/questions/joint_spec.rb | 2 +- spec/models/form/lettings/questions/layear_spec.rb | 2 +- .../models/form/lettings/questions/letting_allocation_spec.rb | 2 +- spec/models/form/lettings/questions/location_id_spec.rb | 2 +- .../form/lettings/questions/managing_organisation_spec.rb | 4 +--- .../form/lettings/questions/nationality_all_group_spec.rb | 2 +- spec/models/form/lettings/questions/nationality_all_spec.rb | 2 +- spec/models/form/lettings/questions/nationality_spec.rb | 2 +- spec/models/form/lettings/questions/needs_type_spec.rb | 2 +- spec/models/form/lettings/questions/net_income_known_spec.rb | 4 +++- spec/models/form/lettings/questions/offered_spec.rb | 2 +- spec/models/form/lettings/questions/period_spec.rb | 2 +- .../form/lettings/questions/person_gender_identity_spec.rb | 2 +- .../form/lettings/questions/postcode_for_full_address_spec.rb | 2 +- spec/models/form/lettings/questions/ppcodenk_spec.rb | 2 +- spec/models/form/lettings/questions/previous_la_known_spec.rb | 2 +- spec/models/form/lettings/questions/previous_let_type_spec.rb | 2 +- .../form/lettings/questions/previous_tenure_renewal_spec.rb | 2 +- spec/models/form/lettings/questions/previous_tenure_spec.rb | 2 +- .../models/form/lettings/questions/property_reference_spec.rb | 2 +- spec/models/form/lettings/questions/reason_renewal_spec.rb | 2 +- spec/models/form/lettings/questions/reason_spec.rb | 2 +- spec/models/form/lettings/questions/reasonpref_spec.rb | 2 +- spec/models/form/lettings/questions/renewal_spec.rb | 2 +- spec/models/form/lettings/questions/rent_type_spec.rb | 2 +- spec/models/form/lettings/questions/rsnvac_spec.rb | 2 +- spec/models/form/lettings/questions/scheme_id_spec.rb | 2 +- spec/models/form/lettings/questions/sheltered_spec.rb | 2 +- .../form/lettings/questions/starter_tenancy_type_spec.rb | 2 +- spec/models/form/lettings/questions/startertenancy_spec.rb | 2 +- spec/models/form/lettings/questions/stock_owner_spec.rb | 4 +--- .../lettings/questions/tenancy_length_affordable_rent_spec.rb | 2 +- .../questions/tenancy_length_intermediate_rent_spec.rb | 2 +- .../form/lettings/questions/tenancy_length_periodic_spec.rb | 2 +- spec/models/form/lettings/questions/tenancy_length_spec.rb | 2 +- spec/models/form/lettings/questions/tenancy_other_spec.rb | 2 +- .../models/form/lettings/questions/tenancy_start_date_spec.rb | 2 +- spec/models/form/lettings/questions/tenancy_type_spec.rb | 2 +- spec/models/form/lettings/questions/tenant_code_spec.rb | 2 +- spec/models/form/lettings/questions/town_or_city_spec.rb | 2 +- spec/models/form/lettings/questions/uprn_spec.rb | 2 +- spec/models/form/lettings/questions/voiddate_spec.rb | 2 +- spec/models/form/lettings/questions/waityear_spec.rb | 2 +- spec/models/form/lettings/questions/wheelchair_spec.rb | 4 ++-- 57 files changed, 60 insertions(+), 62 deletions(-) diff --git a/spec/models/form/lettings/questions/address_line1_spec.rb b/spec/models/form/lettings/questions/address_line1_spec.rb index 0fc91a586..82e6a5274 100644 --- a/spec/models/form/lettings/questions/address_line1_spec.rb +++ b/spec/models/form/lettings/questions/address_line1_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::AddressLine1, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/age1_known_spec.rb b/spec/models/form/lettings/questions/age1_known_spec.rb index 680de4977..ac5af8aab 100644 --- a/spec/models/form/lettings/questions/age1_known_spec.rb +++ b/spec/models/form/lettings/questions/age1_known_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Questions::Age1Known, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/beds_spec.rb b/spec/models/form/lettings/questions/beds_spec.rb index 77340f5d5..6291892b1 100644 --- a/spec/models/form/lettings/questions/beds_spec.rb +++ b/spec/models/form/lettings/questions/beds_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Beds, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/county_spec.rb b/spec/models/form/lettings/questions/county_spec.rb index 1955dad8f..901bd2e9c 100644 --- a/spec/models/form/lettings/questions/county_spec.rb +++ b/spec/models/form/lettings/questions/county_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::County, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/created_by_id_spec.rb b/spec/models/form/lettings/questions/created_by_id_spec.rb index ec3fc7a9b..98e0e283b 100644 --- a/spec/models/form/lettings/questions/created_by_id_spec.rb +++ b/spec/models/form/lettings/questions/created_by_id_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::CreatedById, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index 8230235cf..e61258893 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?) diff --git a/spec/models/form/lettings/questions/ethnic_white_spec.rb b/spec/models/form/lettings/questions/ethnic_white_spec.rb index 6a81afb88..b06490b86 100644 --- a/spec/models/form/lettings/questions/ethnic_white_spec.rb +++ b/spec/models/form/lettings/questions/ethnic_white_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::EthnicWhite, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb b/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb index e88c4ac8b..7f38f0108 100644 --- a/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb +++ b/spec/models/form/lettings/questions/first_time_property_let_as_social_housing_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing, t let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/gender_identity1_spec.rb b/spec/models/form/lettings/questions/gender_identity1_spec.rb index 596e38941..337936dbc 100644 --- a/spec/models/form/lettings/questions/gender_identity1_spec.rb +++ b/spec/models/form/lettings/questions/gender_identity1_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Questions::GenderIdentity1, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(page).to receive(:subsection).and_return(subsection) diff --git a/spec/models/form/lettings/questions/hb_spec.rb b/spec/models/form/lettings/questions/hb_spec.rb index 1c0ce31de..a73f030ad 100644 --- a/spec/models/form/lettings/questions/hb_spec.rb +++ b/spec/models/form/lettings/questions/hb_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Hb, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/housingneeds_other_spec.rb b/spec/models/form/lettings/questions/housingneeds_other_spec.rb index 9054c0c8a..b6649aea4 100644 --- a/spec/models/form/lettings/questions/housingneeds_other_spec.rb +++ b/spec/models/form/lettings/questions/housingneeds_other_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::HousingneedsOther, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/irproduct_other_spec.rb b/spec/models/form/lettings/questions/irproduct_other_spec.rb index 45182104a..aeea7ae20 100644 --- a/spec/models/form/lettings/questions/irproduct_other_spec.rb +++ b/spec/models/form/lettings/questions/irproduct_other_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::IrproductOther, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/is_carehome_spec.rb b/spec/models/form/lettings/questions/is_carehome_spec.rb index 99f13aab0..8a2853aa3 100644 --- a/spec/models/form/lettings/questions/is_carehome_spec.rb +++ b/spec/models/form/lettings/questions/is_carehome_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::IsCarehome, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/joint_spec.rb b/spec/models/form/lettings/questions/joint_spec.rb index 542c1cd30..338110e4d 100644 --- a/spec/models/form/lettings/questions/joint_spec.rb +++ b/spec/models/form/lettings/questions/joint_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Joint, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/layear_spec.rb b/spec/models/form/lettings/questions/layear_spec.rb index 12e8c5746..e42ac704d 100644 --- a/spec/models/form/lettings/questions/layear_spec.rb +++ b/spec/models/form/lettings/questions/layear_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Layear, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/letting_allocation_spec.rb b/spec/models/form/lettings/questions/letting_allocation_spec.rb index ab268d840..78cd5acca 100644 --- a/spec/models/form/lettings/questions/letting_allocation_spec.rb +++ b/spec/models/form/lettings/questions/letting_allocation_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::LettingAllocation, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/location_id_spec.rb b/spec/models/form/lettings/questions/location_id_spec.rb index 0d3f8d1c8..a2c41af80 100644 --- a/spec/models/form/lettings/questions/location_id_spec.rb +++ b/spec/models/form/lettings/questions/location_id_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::LocationId, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_date).and_return(Time.zone.local(2022, 4, 1)) diff --git a/spec/models/form/lettings/questions/managing_organisation_spec.rb b/spec/models/form/lettings/questions/managing_organisation_spec.rb index 62a46bc1e..f35f17b4f 100644 --- a/spec/models/form/lettings/questions/managing_organisation_spec.rb +++ b/spec/models/form/lettings/questions/managing_organisation_spec.rb @@ -5,9 +5,7 @@ RSpec.describe Form::Lettings::Questions::ManagingOrganisation, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/nationality_all_group_spec.rb b/spec/models/form/lettings/questions/nationality_all_group_spec.rb index d92551546..56fc50257 100644 --- a/spec/models/form/lettings/questions/nationality_all_group_spec.rb +++ b/spec/models/form/lettings/questions/nationality_all_group_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::NationalityAllGroup, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/nationality_all_spec.rb b/spec/models/form/lettings/questions/nationality_all_spec.rb index 07c993766..9c274e06c 100644 --- a/spec/models/form/lettings/questions/nationality_all_spec.rb +++ b/spec/models/form/lettings/questions/nationality_all_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::NationalityAll, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/nationality_spec.rb b/spec/models/form/lettings/questions/nationality_spec.rb index d0eaeb69b..f32cf4f0d 100644 --- a/spec/models/form/lettings/questions/nationality_spec.rb +++ b/spec/models/form/lettings/questions/nationality_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::Nationality, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/needs_type_spec.rb b/spec/models/form/lettings/questions/needs_type_spec.rb index 343a10ffd..a0a309f70 100644 --- a/spec/models/form/lettings/questions/needs_type_spec.rb +++ b/spec/models/form/lettings/questions/needs_type_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::NeedsType, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/net_income_known_spec.rb b/spec/models/form/lettings/questions/net_income_known_spec.rb index 80ea412ba..fff32fba0 100644 --- a/spec/models/form/lettings/questions/net_income_known_spec.rb +++ b/spec/models/form/lettings/questions/net_income_known_spec.rb @@ -1,7 +1,9 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::NetIncomeKnown do - subject(:question) { described_class.new(nil, {}, nil) } + subject(:question) { described_class.new(nil, {}, page) } + + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } describe "#id" do it "is net_income_known" do diff --git a/spec/models/form/lettings/questions/offered_spec.rb b/spec/models/form/lettings/questions/offered_spec.rb index 09d103a1b..45a589a32 100644 --- a/spec/models/form/lettings/questions/offered_spec.rb +++ b/spec/models/form/lettings/questions/offered_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::Offered, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to be page diff --git a/spec/models/form/lettings/questions/period_spec.rb b/spec/models/form/lettings/questions/period_spec.rb index 6097dfc55..629be7f28 100644 --- a/spec/models/form/lettings/questions/period_spec.rb +++ b/spec/models/form/lettings/questions/period_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::Period, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has the correct hint" do expect(question.hint_text).to eq("Select how often the household is charged. This may be different to how often they pay.") diff --git a/spec/models/form/lettings/questions/person_gender_identity_spec.rb b/spec/models/form/lettings/questions/person_gender_identity_spec.rb index bff45a624..49daf60ed 100644 --- a/spec/models/form/lettings/questions/person_gender_identity_spec.rb +++ b/spec/models/form/lettings/questions/person_gender_identity_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::PersonGenderIdentity, type: :model do let(:page) { instance_double(Form::Page) } let(:person_index) { 2 } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(page).to receive(:subsection).and_return(subsection) diff --git a/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb b/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb index 337d1e6fe..1cb179ce5 100644 --- a/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb +++ b/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::PostcodeForFullAddress, type: :model d let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/ppcodenk_spec.rb b/spec/models/form/lettings/questions/ppcodenk_spec.rb index ad5e52e96..79613d962 100644 --- a/spec/models/form/lettings/questions/ppcodenk_spec.rb +++ b/spec/models/form/lettings/questions/ppcodenk_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Questions::Ppcodenk, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/previous_la_known_spec.rb b/spec/models/form/lettings/questions/previous_la_known_spec.rb index af269db5e..8b8460ce0 100644 --- a/spec/models/form/lettings/questions/previous_la_known_spec.rb +++ b/spec/models/form/lettings/questions/previous_la_known_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Questions::PreviousLaKnown, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/previous_let_type_spec.rb b/spec/models/form/lettings/questions/previous_let_type_spec.rb index 9f43f0aff..8b28bc93a 100644 --- a/spec/models/form/lettings/questions/previous_let_type_spec.rb +++ b/spec/models/form/lettings/questions/previous_let_type_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb b/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb index 91f1ec158..624229dda 100644 --- a/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb +++ b/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::PreviousTenureRenewal, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has the correct id" do expect(question.id).to eq("prevten") diff --git a/spec/models/form/lettings/questions/previous_tenure_spec.rb b/spec/models/form/lettings/questions/previous_tenure_spec.rb index 4b106601e..c3a598889 100644 --- a/spec/models/form/lettings/questions/previous_tenure_spec.rb +++ b/spec/models/form/lettings/questions/previous_tenure_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::PreviousTenure, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has the correct id" do expect(question.id).to eq("prevten") diff --git a/spec/models/form/lettings/questions/property_reference_spec.rb b/spec/models/form/lettings/questions/property_reference_spec.rb index 82f60c421..b4aa848af 100644 --- a/spec/models/form/lettings/questions/property_reference_spec.rb +++ b/spec/models/form/lettings/questions/property_reference_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::PropertyReference, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } let(:lettings_log) { FactoryBot.create(:lettings_log) } it "has correct page" do diff --git a/spec/models/form/lettings/questions/reason_renewal_spec.rb b/spec/models/form/lettings/questions/reason_renewal_spec.rb index 27b1524c6..5575c7e92 100644 --- a/spec/models/form/lettings/questions/reason_renewal_spec.rb +++ b/spec/models/form/lettings/questions/reason_renewal_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::ReasonRenewal, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/reason_spec.rb b/spec/models/form/lettings/questions/reason_spec.rb index 4ea1a4a35..68f3fdd36 100644 --- a/spec/models/form/lettings/questions/reason_spec.rb +++ b/spec/models/form/lettings/questions/reason_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Reason, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/reasonpref_spec.rb b/spec/models/form/lettings/questions/reasonpref_spec.rb index 9b9bf8a80..1f531921d 100644 --- a/spec/models/form/lettings/questions/reasonpref_spec.rb +++ b/spec/models/form/lettings/questions/reasonpref_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Questions::Reasonpref, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/renewal_spec.rb b/spec/models/form/lettings/questions/renewal_spec.rb index c1c4f5d77..15b6fa84b 100644 --- a/spec/models/form/lettings/questions/renewal_spec.rb +++ b/spec/models/form/lettings/questions/renewal_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Renewal, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/rent_type_spec.rb b/spec/models/form/lettings/questions/rent_type_spec.rb index da1951c09..bc66348f5 100644 --- a/spec/models/form/lettings/questions/rent_type_spec.rb +++ b/spec/models/form/lettings/questions/rent_type_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::RentType, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/rsnvac_spec.rb b/spec/models/form/lettings/questions/rsnvac_spec.rb index d4de17016..bdc84753d 100644 --- a/spec/models/form/lettings/questions/rsnvac_spec.rb +++ b/spec/models/form/lettings/questions/rsnvac_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Rsnvac, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/scheme_id_spec.rb b/spec/models/form/lettings/questions/scheme_id_spec.rb index b1e628612..a9a7887be 100644 --- a/spec/models/form/lettings/questions/scheme_id_spec.rb +++ b/spec/models/form/lettings/questions/scheme_id_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::SchemeId, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/sheltered_spec.rb b/spec/models/form/lettings/questions/sheltered_spec.rb index cf3f59f26..c37646abb 100644 --- a/spec/models/form/lettings/questions/sheltered_spec.rb +++ b/spec/models/form/lettings/questions/sheltered_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::Sheltered, type: :model do let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb b/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb index 3993e1b87..81d0b8b3b 100644 --- a/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb +++ b/spec/models/form/lettings/questions/starter_tenancy_type_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::StarterTenancyType, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(page).to receive(:subsection).and_return(subsection) diff --git a/spec/models/form/lettings/questions/startertenancy_spec.rb b/spec/models/form/lettings/questions/startertenancy_spec.rb index bdbc93897..f5b1e7ec5 100644 --- a/spec/models/form/lettings/questions/startertenancy_spec.rb +++ b/spec/models/form/lettings/questions/startertenancy_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::Startertenancy, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(page).to receive(:subsection).and_return(subsection) diff --git a/spec/models/form/lettings/questions/stock_owner_spec.rb b/spec/models/form/lettings/questions/stock_owner_spec.rb index 74ca0d088..376179cf2 100644 --- a/spec/models/form/lettings/questions/stock_owner_spec.rb +++ b/spec/models/form/lettings/questions/stock_owner_spec.rb @@ -5,9 +5,7 @@ RSpec.describe Form::Lettings::Questions::StockOwner, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb b/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb index 647086ef0..45d2a80eb 100644 --- a/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthAffordableRent, type: :mo let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb b/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb index f15dd7d03..9599997fb 100644 --- a/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthIntermediateRent, type: : let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb b/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb index 7708ee9d8..4a2563e6f 100644 --- a/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthPeriodic, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/tenancy_length_spec.rb b/spec/models/form/lettings/questions/tenancy_length_spec.rb index 0a83d0baa..2de7c99a6 100644 --- a/spec/models/form/lettings/questions/tenancy_length_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_length_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::TenancyLength, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/tenancy_other_spec.rb b/spec/models/form/lettings/questions/tenancy_other_spec.rb index 58a656e57..4891f5e31 100644 --- a/spec/models/form/lettings/questions/tenancy_other_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_other_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" RSpec.describe Form::Lettings::Questions::TenancyOther, type: :model do subject(:question) { described_class.new(nil, nil, page) } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/tenancy_start_date_spec.rb b/spec/models/form/lettings/questions/tenancy_start_date_spec.rb index 56031ffd9..a6c96d989 100644 --- a/spec/models/form/lettings/questions/tenancy_start_date_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_start_date_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyStartDate, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/tenancy_type_spec.rb b/spec/models/form/lettings/questions/tenancy_type_spec.rb index c5ad04a03..6eafc96a7 100644 --- a/spec/models/form/lettings/questions/tenancy_type_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_type_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/tenant_code_spec.rb b/spec/models/form/lettings/questions/tenant_code_spec.rb index a60383119..dc6ed86d5 100644 --- a/spec/models/form/lettings/questions/tenant_code_spec.rb +++ b/spec/models/form/lettings/questions/tenant_code_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenantCode, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/town_or_city_spec.rb b/spec/models/form/lettings/questions/town_or_city_spec.rb index a18d63c04..61262055f 100644 --- a/spec/models/form/lettings/questions/town_or_city_spec.rb +++ b/spec/models/form/lettings/questions/town_or_city_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TownOrCity, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/uprn_spec.rb b/spec/models/form/lettings/questions/uprn_spec.rb index 21d997446..d02a3ff1f 100644 --- a/spec/models/form/lettings/questions/uprn_spec.rb +++ b/spec/models/form/lettings/questions/uprn_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::Uprn, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/voiddate_spec.rb b/spec/models/form/lettings/questions/voiddate_spec.rb index aa3270d89..27aeb72f8 100644 --- a/spec/models/form/lettings/questions/voiddate_spec.rb +++ b/spec/models/form/lettings/questions/voiddate_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::Voiddate, type: :model do let(:question_id) { nil } let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } + let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } it "has correct page" do expect(question.page).to eq(page) diff --git a/spec/models/form/lettings/questions/waityear_spec.rb b/spec/models/form/lettings/questions/waityear_spec.rb index def11af8a..7a322f864 100644 --- a/spec/models/form/lettings/questions/waityear_spec.rb +++ b/spec/models/form/lettings/questions/waityear_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Lettings::Questions::Waityear, type: :model do let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:subsection) { instance_double(Form::Subsection) } - let(:form) { instance_double(Form) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } before do allow(form).to receive(:start_year_after_2024?).and_return(false) diff --git a/spec/models/form/lettings/questions/wheelchair_spec.rb b/spec/models/form/lettings/questions/wheelchair_spec.rb index 1fa65a68b..a5d240d51 100644 --- a/spec/models/form/lettings/questions/wheelchair_spec.rb +++ b/spec/models/form/lettings/questions/wheelchair_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Form::Lettings::Questions::Wheelchair, type: :model do before do allow(page).to receive(:subsection).and_return(subsection) - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false)) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false, start_date: Time.zone.local(2023, 4, 1))) end it "has correct page" do @@ -48,7 +48,7 @@ RSpec.describe Form::Lettings::Questions::Wheelchair, type: :model do context "with 2024 form" do before do - allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: true)) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: true, start_date: Time.zone.local(2024, 4, 1))) end it "has the correct hint_text" do