From 26c0d4455ce8c5f56bc7fbcb1e59b360ff83eff0 Mon Sep 17 00:00:00 2001 From: Nat Dean-Lewis Date: Mon, 3 Aug 2026 17:29:39 +0100 Subject: [PATCH] feat: re-include archived log display test --- ...eck_answers_summary_list_card_component_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/components/check_answers_summary_list_card_component_spec.rb b/spec/components/check_answers_summary_list_card_component_spec.rb index 189548098..76b5d24ff 100644 --- a/spec/components/check_answers_summary_list_card_component_spec.rb +++ b/spec/components/check_answers_summary_list_card_component_spec.rb @@ -1,6 +1,8 @@ require "rails_helper" RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do + include CollectionTimeHelper + subject(:component) { described_class.new(questions:, log:, user:) } let(:rendered) { render_inline(component) } @@ -64,4 +66,16 @@ RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do expect(rendered).to have_link(log.form.get_question("tenancycode", log).check_answer_prompt, href: "/lettings-logs/#{log.id}/tenant-code?referrer=check_answers_new_answer", class: "govuk-link govuk-link--no-visited-state") end end + + context "when a log is from an archived collection year" do + context "when given a set of questions" do + let(:log) { create(:lettings_log, :completed, :ignore_validation_errors, age2: 99, startdate: archived_collection_start_date, assigned_to: create(:user)) } + + it "renders a summary list card without question numbers for the answers to those questions" do + expect(rendered).to have_content(questions.first.answer_label(log)) + expect(rendered).to have_content("Lead tenant’s age") + expect(rendered).not_to include(" - Lead tenant’s age") + end + end + end end