|
|
|
@ -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 |
|
|
|
|