diff --git a/spec/components/check_answers_summary_list_card_component_spec.rb b/spec/components/check_answers_summary_list_card_component_spec.rb index 41bf32e28..fbdb244da 100644 --- a/spec/components/check_answers_summary_list_card_component_spec.rb +++ b/spec/components/check_answers_summary_list_card_component_spec.rb @@ -6,6 +6,15 @@ RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do let(:rendered) { render_inline(component) } context "when before 23/24 collection" do + before do + Timecop.freeze(Time.zone.local(2023, 1, 10)) + Singleton.__init__(FormHandler) + end + + after do + Timecop.return + end + context "when given a set of questions" do let(:user) { build(:user) } let(:log) { build(:lettings_log, :completed, age2: 99, startdate: Time.zone.local(2021, 5, 1)) } diff --git a/spec/models/form/lettings/pages/address_spec.rb b/spec/models/form/lettings/pages/address_spec.rb index 230d6964f..276b5c756 100644 --- a/spec/models/form/lettings/pages/address_spec.rb +++ b/spec/models/form/lettings/pages/address_spec.rb @@ -62,7 +62,7 @@ RSpec.describe Form::Lettings::Pages::Address, type: :model do context "when uprn_confirmed == 1 && uprn_known != 0" do let(:log) do - create(:lettings_log, uprn_known: 1, uprn_confirmed: 1) + create(:lettings_log, uprn_known: 1, uprn_confirmed: 1, uprn: "123456789") end it "returns true" do diff --git a/spec/models/sales_log_spec.rb b/spec/models/sales_log_spec.rb index 511f1820b..148576b8b 100644 --- a/spec/models/sales_log_spec.rb +++ b/spec/models/sales_log_spec.rb @@ -91,6 +91,15 @@ RSpec.describe SalesLog, type: :model do let(:sales_log) { build(:sales_log, created_by: created_by_user) } let(:sales_log_2) { build(:sales_log, saledate: Time.zone.local(2022, 5, 1), created_by: created_by_user) } + before do + Timecop.freeze(Time.zone.local(2023, 1, 10)) + Singleton.__init__(FormHandler) + end + + after do + Timecop.return + end + it "has returns the correct form based on the start date" do expect(sales_log.form_name).to be_nil expect(sales_log.form).to be_a(Form) diff --git a/spec/models/validations/sales/setup_validations_spec.rb b/spec/models/validations/sales/setup_validations_spec.rb index a85177aab..dde80b662 100644 --- a/spec/models/validations/sales/setup_validations_spec.rb +++ b/spec/models/validations/sales/setup_validations_spec.rb @@ -7,6 +7,15 @@ RSpec.describe Validations::Sales::SetupValidations do describe "#validate_saledate_collection_year" do context "with sales_in_crossover_period == false" do + before do + Timecop.freeze(Time.zone.local(2023, 1, 10)) + Singleton.__init__(FormHandler) + end + + after do + Timecop.return + end + context "when saledate is blank" do let(:record) { build(:sales_log, saledate: nil) } diff --git a/spec/models/validations/soft_validations_spec.rb b/spec/models/validations/soft_validations_spec.rb index d355f2fbd..b51a084f5 100644 --- a/spec/models/validations/soft_validations_spec.rb +++ b/spec/models/validations/soft_validations_spec.rb @@ -4,6 +4,15 @@ RSpec.describe Validations::SoftValidations do let(:organisation) { FactoryBot.create(:organisation, provider_type: "PRP") } let(:record) { FactoryBot.create(:lettings_log, owning_organisation: organisation) } + before do + Timecop.freeze(Time.zone.local(2021, 10, 10)) + Singleton.__init__(FormHandler) + end + + after do + Timecop.return + end + describe "rent min max validations" do before do LaRentRange.create!( @@ -23,7 +32,7 @@ RSpec.describe Validations::SoftValidations do record.rent_type = 0 record.beds = 1 record.period = 1 - record.startdate = Time.zone.local(2021, 10, 10) + record.startdate = Time.zone.today end context "when validating soft min" do