From e810f960ae87a50da687f87e7545f9696283c4af Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Mon, 28 Jul 2025 15:47:18 +0100 Subject: [PATCH] CLDC-4074: Update other sales log tests to use the current year instead of a fixed one --- spec/features/sales_log_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/features/sales_log_spec.rb b/spec/features/sales_log_spec.rb index 39e21bf85..a70f11014 100644 --- a/spec/features/sales_log_spec.rb +++ b/spec/features/sales_log_spec.rb @@ -1,6 +1,8 @@ require "rails_helper" RSpec.describe "Sales Log Features" do + include CollectionTimeHelper + context "when searching for specific sales logs" do context "when I am signed in and there are sales logs in the database" do let(:user) { FactoryBot.create(:user, last_sign_in_at: Time.zone.now, name: "Jimbo") } @@ -234,6 +236,7 @@ RSpec.describe "Sales Log Features" do context "when I am signed in" do let(:user) { create(:user, last_sign_in_at: Time.zone.now) } + let(:current_date) { current_collection_start_date } before do create(:sales_log, :in_progress, owning_organisation: user.organisation, assigned_to: user) @@ -243,7 +246,7 @@ RSpec.describe "Sales Log Features" do end context "when viewing pages within a log" do - let(:sales_log) { FactoryBot.create(:sales_log, :shared_ownership_setup_complete, jointpur: 2, owning_organisation: user.organisation, assigned_to: user, saledate: Time.zone.local(2024, 12, 3)) } + let(:sales_log) { FactoryBot.create(:sales_log, :shared_ownership_setup_complete, jointpur: 2, owning_organisation: user.organisation, assigned_to: user, saledate: current_date) } context "when visiting the address page" do before do @@ -251,7 +254,7 @@ RSpec.describe "Sales Log Features" do end it "displays the question number in the page header" do - expect(page).to have_content("Q16") + expect(page).to have_content("Q14") end end @@ -261,7 +264,7 @@ RSpec.describe "Sales Log Features" do end it "has the expected content" do - expect(page).to have_content(/Shared ownership scheme\s*About the staircasing transaction/) + expect(page).to have_content(/Shared ownership - staircasing transaction\s*About the staircasing transaction/) end end end