From d3e96fd6a85172b4b38d895fd691079114d0457c Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 20 Nov 2024 09:43:04 +0000 Subject: [PATCH] Update privacy notice page tests --- .../form/sales/pages/privacy_notice_spec.rb | 34 ++++--------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/spec/models/form/sales/pages/privacy_notice_spec.rb b/spec/models/form/sales/pages/privacy_notice_spec.rb index 80be7ae66..8b21e7b9e 100644 --- a/spec/models/form/sales/pages/privacy_notice_spec.rb +++ b/spec/models/form/sales/pages/privacy_notice_spec.rb @@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do let(:page_id) { "privacy_notice" } let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection, id: "setup") } + let(:subsection) { instance_double(Form::Subsection, id: "setup", copy_key: "setup") } let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } before do @@ -31,20 +31,10 @@ RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do context "when there are joint buyers" do subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: true) } - context "when the form start year is before 2024" do - let(:subsection) { instance_double(Form::Subsection, id: "household_characteristics") } + let(:subsection) { instance_double(Form::Subsection, id: "subsection_id", copy_key: "subsection_copy_key") } - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.household_characteristics.privacynotice.joint_purchase") - end - end - - context "when the form start year is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } - - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.setup.privacynotice.joint_purchase") - end + it "has the expected copy_key" do + expect(page.copy_key).to eq("sales.subsection_copy_key.privacynotice.joint_purchase") end it "has correct depends_on" do @@ -55,20 +45,10 @@ RSpec.describe Form::Sales::Pages::PrivacyNotice, type: :model do context "when there is a single buyer" do subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: false) } - context "when the form start year is before 2024" do - let(:subsection) { instance_double(Form::Subsection, id: "household_characteristics") } - - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.household_characteristics.privacynotice.not_joint_purchase") - end - end - - context "when the form start year is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } + let(:subsection) { instance_double(Form::Subsection, id: "subsection_id", copy_key: "subsection_copy_key") } - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.setup.privacynotice.not_joint_purchase") - end + it "has the expected copy_key" do + expect(page.copy_key).to eq("sales.subsection_copy_key.privacynotice.not_joint_purchase") end it "has correct depends_on" do