Browse Source

feat: add test for q numbers in 23/24 year only

pull/1381/head
natdeanlewissoftwire 3 years ago
parent
commit
e5c1a06c3a
  1. 21
      spec/components/check_answers_summary_list_card_component_spec.rb

21
spec/components/check_answers_summary_list_card_component_spec.rb

@ -5,6 +5,7 @@ RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do
let(:rendered) { render_inline(component) } let(:rendered) { render_inline(component) }
context "when before 23/24 collection" do
context "when given a set of questions" do context "when given a set of questions" do
let(:user) { build(:user) } let(:user) { build(:user) }
let(:log) { build(:lettings_log, :completed, age2: 99, startdate: Time.zone.local(2021, 5, 1)) } let(:log) { build(:lettings_log, :completed, age2: 99, startdate: Time.zone.local(2021, 5, 1)) }
@ -12,8 +13,10 @@ RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do
let(:subsection) { log.form.get_subsection(subsection_id) } let(:subsection) { log.form.get_subsection(subsection_id) }
let(:questions) { subsection.applicable_questions(log) } let(:questions) { subsection.applicable_questions(log) }
it "renders a summary list card for the answers to those questions" do 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(questions.first.answer_label(log))
expect(rendered).to have_content("Lead tenant’s age")
expect(rendered).not_to have_content("Q32 - Lead tenant’s age")
end end
it "applicable questions doesn't return questions that are hidden in check answers" do it "applicable questions doesn't return questions that are hidden in check answers" do
@ -46,4 +49,20 @@ RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do
end end
end end
end end
end
context "when in 23/24 collection" do
context "when given a set of questions" do
let(:user) { build(:user) }
let(:log) { build(:lettings_log, :completed, age2: 99, startdate: Time.zone.local(2023, 5, 1)) }
let(:subsection_id) { "household_characteristics" }
let(:subsection) { log.form.get_subsection(subsection_id) }
let(:questions) { subsection.applicable_questions(log) }
it "renders a summary list card includinq question numbers for the answers to those questions" do
expect(rendered).to have_content(questions.first.answer_label(log))
expect(rendered).to have_content("Q32 - Lead tenant’s age")
end
end
end
end end

Loading…
Cancel
Save