Browse Source

Update privacy notice page tests

pull/2792/head
Rachael Booth 7 months ago
parent
commit
d3e96fd6a8
  1. 34
      spec/models/form/sales/pages/privacy_notice_spec.rb

34
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

Loading…
Cancel
Save