diff --git a/spec/models/form/lettings/questions/homeless_spec.rb b/spec/models/form/lettings/questions/homeless_spec.rb index f18a8ece7..7f2c1b054 100644 --- a/spec/models/form/lettings/questions/homeless_spec.rb +++ b/spec/models/form/lettings/questions/homeless_spec.rb @@ -28,10 +28,6 @@ RSpec.describe Form::Lettings::Questions::Homeless, type: :model do }) end - it "has no hint text" do - expect(question.hint_text).to be_empty - end - it "has the correct check_answers_card_number" do expect(question.check_answers_card_number).to eq(0) end diff --git a/spec/models/form/sales/pages/buyer_interview_spec.rb b/spec/models/form/sales/pages/buyer_interview_spec.rb index f7c6bbb70..ea707a0fe 100644 --- a/spec/models/form/sales/pages/buyer_interview_spec.rb +++ b/spec/models/form/sales/pages/buyer_interview_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Sales::Pages::BuyerInterview, type: :model do let(:page_id) { "buyer_interview" } let(:page_definition) { nil } let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } - let(:subsection) { instance_double(Form::Subsection, form:, id: "setup") } + let(:subsection) { instance_double(Form::Subsection, form:, id: "setup", copy_key: "subsection_copy_key") } it "has correct subsection" do expect(page.subsection).to eq(subsection) @@ -24,43 +24,23 @@ RSpec.describe Form::Sales::Pages::BuyerInterview, type: :model do expect(page.description).to be_nil end - context "when form is before 2024" do - let(:subsection) { instance_double(Form::Subsection, form:, id: "household_characteristics") } + context "when there are joint buyers" do + subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: true) } - context "when there are joint buyers" do - subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: true) } + let(:subsection) { instance_double(Form::Subsection, form:, copy_key: "subsection_copy_key") } - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.household_characteristics.noint.joint_purchase") - end - end - - context "when there is a single buyer" do - subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: false) } - - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.household_characteristics.noint.not_joint_purchase") - end + it "has the expected copy_key" do + expect(page.copy_key).to eq("sales.subsection_copy_key.noint.joint_purchase") end end - context "when form is after 2024" do - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2024_or_later?: true) } - - context "when there are joint buyers" do - subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: true) } - - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.setup.noint.joint_purchase") - end - end + context "when there is a single buyer" do + subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: false) } - context "when there is a single buyer" do - subject(:page) { described_class.new(page_id, page_definition, subsection, joint_purchase: false) } + let(:subsection) { instance_double(Form::Subsection, form:, copy_key: "subsection_copy_key") } - it "has the expected copy_key" do - expect(page.copy_key).to eq("sales.setup.noint.not_joint_purchase") - end + it "has the expected copy_key" do + expect(page.copy_key).to eq("sales.subsection_copy_key.noint.not_joint_purchase") end end end diff --git a/spec/models/form/sales/questions/buyer_interview_spec.rb b/spec/models/form/sales/questions/buyer_interview_spec.rb index 0db43407f..e812f6146 100644 --- a/spec/models/form/sales/questions/buyer_interview_spec.rb +++ b/spec/models/form/sales/questions/buyer_interview_spec.rb @@ -6,7 +6,8 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do let(:question_id) { nil } let(:question_definition) { nil } let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: true) } - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: "setup")) } + let(:subsection) { instance_double(Form::Subsection, form:, copy_key: "setup") } + let(:page) { instance_double(Form::Page, subsection:) } it "has correct page" do expect(question.page).to eq(page) @@ -34,42 +35,20 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do context "when there are joint buyers" do subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: true) } - context "when the form start year is before 2024" do - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: "household_characteristics")) } - let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 3, 1), start_year_2024_or_later?: false) } + let(:subsection) { instance_double(Form::Subsection, form:, copy_key: "subsection_copy_key") } - it "has the expected copy_key" do - expect(question.copy_key).to eq("sales.household_characteristics.noint.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(question.copy_key).to eq("sales.setup.noint.joint_purchase") - end + it "has the expected copy_key" do + expect(question.copy_key).to eq("sales.subsection_copy_key.noint.joint_purchase") end end context "when there is a single buyer" do subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: false) } - context "when the form start year is before 2024" do - let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: "household_characteristics")) } - let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2024_or_later?: false) } - - it "has the expected copy_key" do - expect(question.copy_key).to eq("sales.household_characteristics.noint.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, form:, copy_key: "subsection_copy_key") } - it "has the expected copy_key" do - expect(question.copy_key).to eq("sales.setup.noint.not_joint_purchase") - end + it "has the expected copy_key" do + expect(question.copy_key).to eq("sales.subsection_copy_key.noint.not_joint_purchase") end end end diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index 5f764c7af..f279c6bf9 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do let(:question_id) { nil } let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } - 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)) } before do @@ -32,7 +32,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end context "when the form year is before 2024" do - let(:subsection) { instance_double(Form::Subsection, id: "household_characteristics") } + let(:subsection) { instance_double(Form::Subsection, id: "household_characteristics", copy_key: "household_characteristics") } before do allow(form).to receive(:start_year_2024_or_later?).and_return(false) diff --git a/spec/models/form/sales/questions/uprn_confirmation_spec.rb b/spec/models/form/sales/questions/uprn_confirmation_spec.rb index 0e54155b6..c6f7fd723 100644 --- a/spec/models/form/sales/questions/uprn_confirmation_spec.rb +++ b/spec/models/form/sales/questions/uprn_confirmation_spec.rb @@ -25,10 +25,6 @@ RSpec.describe Form::Sales::Questions::UprnConfirmation, type: :model do expect(question.derived?(nil)).to be false end - it "has the correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must answer #{format_ending(I18n.t('forms.2023.sales.property_information.uprn_confirmed.check_answer_label'))}") - end - describe "notification_banner" do context "when address is not present" do it "returns nil" do