From 201507887f8e487839877f707c0ec78ad71c0a64 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:32:28 +0000 Subject: [PATCH] Update staircase page test with 2025 --- .../models/form/sales/pages/staircase_spec.rb | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/spec/models/form/sales/pages/staircase_spec.rb b/spec/models/form/sales/pages/staircase_spec.rb index 4a2899c43..6d7d550fd 100644 --- a/spec/models/form/sales/pages/staircase_spec.rb +++ b/spec/models/form/sales/pages/staircase_spec.rb @@ -7,23 +7,40 @@ RSpec.describe Form::Sales::Pages::Staircase, type: :model do let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))) } - before do - allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(false) - end + context "when start year is 2024" do + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)), id: "sale_information") } - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end + before do + allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(false) + end - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[staircase]) - end + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[staircase]) + end - it "has the correct id" do - expect(page.id).to eq("staircasing") + it "has the correct id" do + expect(page.id).to eq("staircasing") + end + + it "has the correct description" do + expect(page.description).to be_nil + end end - it "has the correct description" do - expect(page.description).to be_nil + context "when start year is >= 2025" do + let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)), id: "setup") } + + before do + allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end end + end