Browse Source
* Refactor details known to reuse pages and questions * Refactor page_depends_on * Use field_for_person * feat: tweak person_known behaviour to only show for people 2-4, and ask person_known regardless of answer to previous person_known questions. Also remove redundant personx_known files * test: update tests * feat: add dynamic cya card titles * refactor: simplificaiton * refactor: use check_answers_card_number again * refactor: linting * tests: add card title tests for sales log CYA page * refactor: linting * feat: make private method private * feat: update person known behaviour * test: update tests * test: update tests * test: add new person known tests * feat: remove buyer 1 working situation duplicated header * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk>pull/1134/head
natdeanlewissoftwire
2 years ago
committed by
GitHub
22 changed files with 589 additions and 149 deletions
@ -1,7 +1,7 @@
|
||||
require "rails_helper" |
||||
require_relative "helpers" |
||||
|
||||
RSpec.describe "Form Check Answers Page" do |
||||
RSpec.describe "Lettings Log Check Answers Page" do |
||||
include Helpers |
||||
let(:user) { FactoryBot.create(:user) } |
||||
let(:subsection) { "household-characteristics" } |
@ -0,0 +1,62 @@
|
||||
require "rails_helper" |
||||
require_relative "helpers" |
||||
|
||||
RSpec.describe "Sales Log Check Answers Page" do |
||||
include Helpers |
||||
let(:user) { FactoryBot.create(:user) } |
||||
let(:subsection) { "household-characteristics" } |
||||
let(:conditional_subsection) { "conditional-question" } |
||||
|
||||
let(:completed_sales_log_joint_purchase) do |
||||
FactoryBot.create( |
||||
:sales_log, |
||||
:completed, |
||||
created_by: user, |
||||
jointpur: 1, |
||||
) |
||||
end |
||||
|
||||
let(:completed_sales_log_non_joint_purchase) do |
||||
FactoryBot.create( |
||||
:sales_log, |
||||
:completed, |
||||
created_by: user, |
||||
jointpur: 2, |
||||
) |
||||
end |
||||
|
||||
before do |
||||
sign_in user |
||||
end |
||||
|
||||
context "when the user needs to check their answers for a subsection" do |
||||
let(:last_question_for_subsection) { "propcode" } |
||||
|
||||
it "does not group questions into summary cards if the questions in the subsection don't have a check_answers_card_number attribute" do |
||||
visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/household-needs/check-answers") |
||||
assert_selector ".x-govuk-summary-card__title", count: 0 |
||||
end |
||||
|
||||
context "when the user is checking their answers for the household characteristics subsection" do |
||||
context "and the log is for a joint purchase" do |
||||
it "they see a seperate summary card for each member of the household" do |
||||
visit("/sales-logs/#{completed_sales_log_joint_purchase.id}/#{subsection}/check-answers") |
||||
assert_selector ".x-govuk-summary-card__title", text: "Buyer 1", count: 1 |
||||
assert_selector ".x-govuk-summary-card__title", text: "Buyer 2", count: 1 |
||||
assert_selector ".x-govuk-summary-card__title", text: "Person 1", count: 1 |
||||
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 0 |
||||
end |
||||
end |
||||
|
||||
context "and the log is for a non-joint purchase" do |
||||
it "they see a seperate summary card for each member of the household" do |
||||
visit("/sales-logs/#{completed_sales_log_non_joint_purchase.id}/#{subsection}/check-answers") |
||||
assert_selector ".x-govuk-summary-card__title", text: "Buyer 1", count: 1 |
||||
assert_selector ".x-govuk-summary-card__title", text: "Buyer 2", count: 0 |
||||
assert_selector ".x-govuk-summary-card__title", text: "Person 1", count: 1 |
||||
assert_selector ".x-govuk-summary-card__title", text: "Person 2", count: 0 |
||||
end |
||||
end |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue