diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb
index 573c8631a..bb99cd040 100644
--- a/app/controllers/form_controller.rb
+++ b/app/controllers/form_controller.rb
@@ -8,8 +8,12 @@ class FormController < ApplicationController
@page = @case_log.form.get_page(params[:case_log][:page])
responses_for_page = responses_for_page(@page)
if @case_log.update(responses_for_page) && @case_log.has_no_unresolved_soft_errors?
- redirect_path = @case_log.form.next_page_redirect_path(@page, @case_log)
- redirect_to(send(redirect_path, @case_log))
+ if @case_log.form.is_last_question?(@page, @case_log.form.subsection_for_page(@page), @case_log)
+ redirect_to(case_logs_path)
+ else
+ redirect_path = @case_log.form.next_page_redirect_path(@page, @case_log)
+ redirect_to(send(redirect_path, @case_log))
+ end
else
@subsection = @case_log.form.subsection_for_page(@page)
render "form/page", status: :unprocessable_entity
diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb
index 66d24bf8d..aeccfc4cd 100644
--- a/app/models/bulk_upload.rb
+++ b/app/models/bulk_upload.rb
@@ -196,8 +196,7 @@ class BulkUpload
intermediate_rent_product_name: row[131],
# data_protection: row[132],
sale_or_letting: "letting",
- gdpr_acceptance: 1,
- gdpr_declined: 0,
+ declaration: 1,
}
end
diff --git a/app/models/case_log.rb b/app/models/case_log.rb
index c8922029a..1cb3a4cc9 100644
--- a/app/models/case_log.rb
+++ b/app/models/case_log.rb
@@ -7,6 +7,7 @@ class CaseLogValidator < ActiveModel::Validator
include Validations::TenancyValidations
include Validations::DateValidations
include Validations::LocalAuthorityValidations
+ include Validations::SubmissionValidations
def validate(record)
validation_methods = public_methods.select { |method| method.starts_with?("validate_") }
@@ -140,6 +141,7 @@ class CaseLog < ApplicationRecord
enum is_carehome: POLAR, _suffix: true
enum nocharge: POLAR, _suffix: true
enum referral: REFERRAL, _suffix: true
+ enum declaration: POLAR, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze
OPTIONAL_FIELDS = %w[postcode_known la_known first_time_property_let_as_social_housing].freeze
diff --git a/app/models/form.rb b/app/models/form.rb
index f14adc9f8..f00507f50 100644
--- a/app/models/form.rb
+++ b/app/models/form.rb
@@ -79,7 +79,7 @@ class Form
next_subsection_id_index = subsection_ids.index(subsection.id) + 1
next_subsection = get_subsection(subsection_ids[next_subsection_id_index])
- if next_subsection.id == "declaration" && case_log.status != "completed"
+ if subsection.id == "declaration" && case_log.status != "completed"
next_subsection = get_subsection(subsection_ids[0])
end
@@ -122,4 +122,9 @@ class Form
def readonly_questions
questions.select(&:read_only?)
end
+
+ def is_last_question?(page, subsection, case_log)
+ subsection_ids = subsections.map(&:id)
+ subsection.id == subsection_ids[subsection_ids.length - 1] && next_page(page, case_log) == :check_answers
+ end
end
diff --git a/app/models/form/question.rb b/app/models/form/question.rb
index 5282bae71..3510c8c38 100644
--- a/app/models/form/question.rb
+++ b/app/models/form/question.rb
@@ -79,8 +79,6 @@ class Form::Question
end
def completed?(case_log)
- # Special case as No is a valid answer but doesn't let you progress and use the service
- return false if id == "gdpr_acceptance" && case_log[id] == "No"
return answer_options.keys.any? { |key| case_log[key] == "Yes" } if type == "checkbox"
case_log[id].present? || !case_log.respond_to?(id.to_sym) || has_inferred_display_value?(case_log)
diff --git a/app/models/validations/submission_validations.rb b/app/models/validations/submission_validations.rb
new file mode 100644
index 000000000..9f8bf76d0
--- /dev/null
+++ b/app/models/validations/submission_validations.rb
@@ -0,0 +1,10 @@
+module Validations::SubmissionValidations
+ # Validations methods need to be called 'validate_' to run on model save
+ # or 'validate_' to run on submit as well
+
+ def validate_declaration(record)
+ if record.declaration == "No"
+ record.errors.add :declaration, I18n.t("validations.declaration.missing")
+ end
+ end
+end
diff --git a/app/views/case_logs/edit.html.erb b/app/views/case_logs/edit.html.erb
index 6c8b38e93..5cd0de9a4 100644
--- a/app/views/case_logs/edit.html.erb
+++ b/app/views/case_logs/edit.html.erb
@@ -21,12 +21,14 @@
<% next_incomplete_section = get_next_incomplete_section(@case_log) %>
- >
- Skip to next incomplete section: <%= next_incomplete_section.label %>
-
+ <% if next_incomplete_section.present? %>
+ >
+ Skip to next incomplete section: <%= next_incomplete_section.label %>
+
+ <% end %>
<%= render "tasklist" %>
diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb
index 893cd10dc..bf648599f 100644
--- a/app/views/form/page.html.erb
+++ b/app/views/form/page.html.erb
@@ -47,7 +47,11 @@
<% end %>
<%= f.hidden_field :page, value: @page.id %>
- <%= f.govuk_submit "Save and continue" %>
+ <% if @case_log.form.is_last_question?(@page, @subsection, @case_log) %>
+ <%= f.govuk_submit "Submit lettings log" %>
+ <%else %>
+ <%= f.govuk_submit "Save and continue" %>
+ <%end %>
<% end %>
diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json
index 7ebdfdfef..9228e1eac 100644
--- a/config/forms/2021_2022.json
+++ b/config/forms/2021_2022.json
@@ -9,30 +9,6 @@
"setup": {
"label": "Set up your lettings log",
"pages": {
- "gdpr_acceptance": {
- "header": "",
- "description": "",
- "questions": {
- "gdpr_acceptance": {
- "check_answer_label": "Privacy notice seen",
- "header": "Has the tenant or buyer seen the Department for Levelling Up, Housing and Communities (DLUHC) privacy notice?",
- "hint_text": "You must show the privacy notice to the tenant or buyer before you can use this service.",
- "type": "radio",
- "answer_options": {
- "0": "Yes",
- "1": "No"
- }
- }
- }
- },
- "gdpr_declined": {
- "hide_subsection_label": true,
- "header": "You cannot use this service",
- "hint_text": "",
- "description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.
Go to your logs",
- "questions": {},
- "depends_on": [{ "gdpr_acceptance": "No" }]
- },
"organisation_details": {
"header": "Organisation details",
"description": "",
@@ -57,8 +33,7 @@
"1": "B"
}
}
- },
- "depends_on": [{ "gdpr_acceptance": "Yes" }]
+ }
},
"renewal": {
"header": "",
@@ -74,10 +49,7 @@
"0": "No"
}
}
- },
- "depends_on": [{
- "gdpr_acceptance": "Yes"
- }]
+ }
},
"startdate": {
"header": "",
@@ -89,10 +61,7 @@
"hint_text": "For example, 27 3 2021.",
"type": "date"
}
- },
- "depends_on": [{
- "gdpr_acceptance": "Yes"
- }]
+ }
},
"about_this_letting": {
"header": "Tell us about this letting",
@@ -132,10 +101,7 @@
"0": "Supported housing"
}
}
- },
- "depends_on": [{
- "gdpr_acceptance": "Yes"
- }]
+ }
},
"tenant_code": {
"header": "",
@@ -148,10 +114,7 @@
"type": "text",
"width": 10
}
- },
- "depends_on": [{
- "gdpr_acceptance": "Yes"
- }]
+ }
},
"property_reference": {
"header": "",
@@ -164,8 +127,7 @@
"type": "text",
"width": 10
}
- },
- "depends_on": [{ "gdpr_acceptance": "Yes" }]
+ }
}
}
}
@@ -3226,9 +3188,12 @@
"questions": {
"declaration": {
"check_answer_label": "",
- "header": "What is the tenant code?",
+ "header": "Submit your lettings log ",
"hint_text": "",
- "type": "text"
+ "type": "checkbox",
+ "answer_options": {
+ "declaration": "The tenant has seen the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice"
+ }
}
}
}
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 17e5ce3aa..c40da4bda 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -115,6 +115,9 @@ en:
referral:
rsnvac_non_temp: "Answer cannot be this source of referral as you already told us this is a re-let to tenant who occupied the same property as temporary accommodation"
+ declaration:
+ missing: "You must show the DLUHC privacy notice to the tenant before you can submit this log."
+
soft_validations:
net_income:
hint_text: "This is based on the tenant’s work situation: %{ecstat1}"
diff --git a/db/migrate/20220207091117_add_declaration.rb b/db/migrate/20220207091117_add_declaration.rb
new file mode 100644
index 000000000..f9b6be7e3
--- /dev/null
+++ b/db/migrate/20220207091117_add_declaration.rb
@@ -0,0 +1,7 @@
+class AddDeclaration < ActiveRecord::Migration[7.0]
+ def change
+ change_table :case_logs, bulk: true do |t|
+ t.column :declaration, :integer
+ end
+ end
+end
diff --git a/db/migrate/20220208101235_remove_gdpr_fields.rb b/db/migrate/20220208101235_remove_gdpr_fields.rb
new file mode 100644
index 000000000..7272c483d
--- /dev/null
+++ b/db/migrate/20220208101235_remove_gdpr_fields.rb
@@ -0,0 +1,15 @@
+class RemoveGdprFields < ActiveRecord::Migration[7.0]
+ def up
+ change_table :case_logs, bulk: true do |t|
+ t.remove :gdpr_declined
+ t.remove :gdpr_acceptance
+ end
+ end
+
+ def down
+ change_table :case_logs, bulk: true do |t|
+ t.column :gdpr_declined, :string
+ t.column :gdpr_acceptance, :string
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 29e45f85d..9646f5029 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,8 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2022_02_07_1123100) do
+ActiveRecord::Schema.define(version: 202202071123100) do
+
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -129,8 +130,6 @@ ActiveRecord::Schema.define(version: 2022_02_07_1123100) do
t.datetime "discarded_at"
t.string "tenancyother"
t.integer "override_net_income_validation"
- t.string "gdpr_acceptance"
- t.string "gdpr_declined"
t.string "property_owner_organisation"
t.string "property_manager_organisation"
t.string "sale_or_letting"
@@ -192,6 +191,7 @@ ActiveRecord::Schema.define(version: 2022_02_07_1123100) do
t.decimal "tcharge", precision: 10, scale: 2
t.decimal "tshortfall", precision: 10, scale: 2
t.decimal "chcharge", precision: 10, scale: 2
+ t.integer "declaration"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
t.index ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id"
t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id"
diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb
index 0a73e7750..b3c952ded 100644
--- a/spec/factories/case_log.rb
+++ b/spec/factories/case_log.rb
@@ -3,7 +3,6 @@ FactoryBot.define do
owning_organisation { FactoryBot.create(:organisation) }
managing_organisation { FactoryBot.create(:organisation) }
trait :about_completed do
- gdpr_acceptance { "Yes" }
renewal { "No" }
needstype { 1 }
rent_type { 1 }
@@ -112,8 +111,6 @@ FactoryBot.define do
tenancyother { nil }
override_net_income_validation { nil }
net_income_known { "Weekly" }
- gdpr_acceptance { "Yes" }
- gdpr_declined { "No" }
property_owner_organisation { "Test" }
property_manager_organisation { "Test" }
renewal { 1 }
@@ -152,6 +149,7 @@ FactoryBot.define do
chcharge { 7 }
letting_in_sheltered_accomodation { "No" }
la_known { "Yes" }
+ declaration { "Yes" }
end
created_at { Time.zone.now }
updated_at { Time.zone.now }
diff --git a/spec/features/form/check_answers_page_spec.rb b/spec/features/form/check_answers_page_spec.rb
index c51ddfa48..cadc0ec3e 100644
--- a/spec/features/form/check_answers_page_spec.rb
+++ b/spec/features/form/check_answers_page_spec.rb
@@ -209,7 +209,7 @@ RSpec.describe "Form Check Answers Page" do
end
it "they can click a button to cycle around to the next incomplete section" do
- visit("/logs/#{cycle_sections_case_log.id}/setup/check-answers")
+ visit("/logs/#{cycle_sections_case_log.id}/declaration/check-answers")
click_link("Save and go to next incomplete section")
expect(page).to have_current_path("/logs/#{cycle_sections_case_log.id}/tenant-code")
end
diff --git a/spec/features/form/tasklist_page_spec.rb b/spec/features/form/tasklist_page_spec.rb
index 12a6afd6f..ba731e05e 100644
--- a/spec/features/form/tasklist_page_spec.rb
+++ b/spec/features/form/tasklist_page_spec.rb
@@ -33,12 +33,12 @@ RSpec.describe "Task List" do
it "shows the number of completed sections if no sections are completed" do
visit("/logs/#{empty_case_log.id}")
- expect(page).to have_content("You have completed 0 of 10 sections.")
+ expect(page).to have_content("You have completed 0 of 9 sections.")
end
it "shows the number of completed sections if one section is completed" do
answer_all_questions_in_income_subsection(empty_case_log)
visit("/logs/#{empty_case_log.id}")
- expect(page).to have_content("You have completed 1 of 10 sections.")
+ expect(page).to have_content("You have completed 1 of 9 sections.")
end
end
diff --git a/spec/features/form/validations_spec.rb b/spec/features/form/validations_spec.rb
index 246f6af30..c11d238f3 100644
--- a/spec/features/form/validations_spec.rb
+++ b/spec/features/form/validations_spec.rb
@@ -25,6 +25,16 @@ RSpec.describe "validations" do
managing_organisation: user.organisation,
)
end
+ let(:completed_without_declaration) do
+ FactoryBot.create(
+ :case_log,
+ :completed,
+ owning_organisation: user.organisation,
+ managing_organisation: user.organisation,
+ status: 1,
+ declaration: nil,
+ )
+ end
let(:id) { case_log.id }
describe "Question validation" do
@@ -162,4 +172,25 @@ RSpec.describe "validations" do
end
end
end
+
+ describe "Submission validation" do
+ context "when tenant has not seen the privacy notice" do
+ it "shows a warning" do
+ visit("/logs/#{completed_without_declaration.id}/declaration")
+ expect(page).to have_current_path("/logs/#{completed_without_declaration.id}/declaration")
+ click_button("Submit lettings log")
+ expect(page).to have_content("You must show the DLUHC privacy notice to the tenant")
+ end
+ end
+
+ context "when tenant has seen the privacy notice" do
+ it "lets submit the log" do
+ completed_without_declaration.update!({ declaration: "Yes" })
+ visit("/logs/#{completed_without_declaration.id}/declaration")
+ expect(page).to have_current_path("/logs/#{completed_without_declaration.id}/declaration")
+ click_button("Submit lettings log")
+ expect(page).to have_current_path("/logs")
+ end
+ end
+ end
end
diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json
index 577523dc9..d3b9396bf 100644
--- a/spec/fixtures/complete_case_log.json
+++ b/spec/fixtures/complete_case_log.json
@@ -122,8 +122,6 @@
"rp_dontknow": "No",
"discarded_at": "05/05/2020",
"override_net_income_validation": "",
- "gdpr_acceptance": "",
- "gdpr_declined": "",
"property_owner_organisation": "",
"property_manager_organisation": "",
"rent_type": "Social Rent",
@@ -147,6 +145,7 @@
"household_charge": "Yes",
"is_carehome": "Yes",
"chcharge": "6",
- "letting_in_sheltered_accomodation": "No"
+ "letting_in_sheltered_accomodation": "No",
+ "declaration": "Yes"
}
}
diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json
index 3a322369e..12fb93b95 100644
--- a/spec/fixtures/forms/2021_2022.json
+++ b/spec/fixtures/forms/2021_2022.json
@@ -626,32 +626,6 @@
}
}
},
- "setup": {
- "label": "Before you start",
- "subsections": {
- "setup": {
- "label": "Set up your lettings log",
- "pages": {
- "gdpr_acceptance": {
- "header": "",
- "description": "",
- "questions": {
- "gdpr_acceptance": {
- "check_answer_label": "Privacy notice seen",
- "header": "Has the tenant or buyer seen the Department for Levelling Up, Housing and Communities (DLUHC) privacy notice?",
- "hint_text": "You must show the privacy notice to the tenant or buyer before you can use this service.",
- "type": "radio",
- "answer_options": {
- "0": "Yes",
- "1": "No"
- }
- }
- }
- }
- }
- }
- }
- },
"submission": {
"label": "Submission",
"subsections": {
@@ -661,19 +635,18 @@
"household_characteristics": "completed",
"household_needs": "completed",
"tenancy_information": "completed",
- "property_information": "completed",
- "income_and_benefits": "completed",
- "rent_and_charges": "completed",
- "local_authority": "completed"
+ "property_information": "completed"
}],
"pages": {
"declaration": {
"questions": {
"declaration": {
"check_answer_label": "",
- "header": "What is the tenant code?",
- "type": "text",
- "width": 10
+ "header": "Submit your lettings log ",
+ "type": "checkbox",
+ "answer_options": {
+ "declaration": "The tenant has seen the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice"
+ }
}
}
}
diff --git a/spec/fixtures/forms/2022_2023.json b/spec/fixtures/forms/2022_2023.json
index 68d1c1247..b599e3067 100644
--- a/spec/fixtures/forms/2022_2023.json
+++ b/spec/fixtures/forms/2022_2023.json
@@ -7,30 +7,6 @@
"setup": {
"label": "Set up your lettings log",
"pages": {
- "gdpr_acceptance": {
- "header": "",
- "description": "",
- "questions": {
- "gdpr_acceptance": {
- "check_answer_label": "Privacy notice seen",
- "header": "Has the tenant or buyer seen the Department for Levelling Up, Housing and Communities (DLUHC) privacy notice?",
- "hint_text": "You must show the privacy notice to the tenant or buyer before you can use this service.",
- "type": "radio",
- "answer_options": {
- "0": "Yes",
- "1": "No"
- }
- }
- }
- },
- "gdpr_declined": {
- "header": "You cannot use this service",
- "hint_text": "",
- "description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.",
- "questions": {
- },
- "depends_on": [{ "gdpr_acceptance": "No" }]
- },
"renewal": {
"header": "",
"description": "",
@@ -45,10 +21,7 @@
"0": "No"
}
}
- },
- "depends_on": [{
- "gdpr_acceptance": "Yes"
- }]
+ }
},
"startdate": {
"header": "",
@@ -60,10 +33,7 @@
"hint_text": "For example, 27 3 2007",
"type": "date"
}
- },
- "depends_on": [{
- "gdpr_acceptance": "Yes"
- }]
+ }
},
"about_this_letting": {
"header": "Tell us about this letting",
@@ -101,10 +71,7 @@
"1": "General needs"
}
}
- },
- "depends_on": [{
- "gdpr_acceptance": "Yes"
- }]
+ }
}
}
}
diff --git a/spec/helpers/tasklist_helper_spec.rb b/spec/helpers/tasklist_helper_spec.rb
index 578edf7c6..18b436a8a 100644
--- a/spec/helpers/tasklist_helper_spec.rb
+++ b/spec/helpers/tasklist_helper_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe TasklistHelper do
describe "get sections count" do
it "returns the total of sections if no status is given" do
- expect(get_subsections_count(empty_case_log)).to eq(10)
+ expect(get_subsections_count(empty_case_log)).to eq(9)
end
it "returns 0 sections for completed sections if no sections are completed" do
@@ -30,7 +30,7 @@ RSpec.describe TasklistHelper do
end
it "returns the number of not started sections" do
- expect(get_subsections_count(empty_case_log, :not_started)).to eq(9)
+ expect(get_subsections_count(empty_case_log, :not_started)).to eq(8)
end
it "returns the number of sections in progress" do
diff --git a/spec/models/form/question_spec.rb b/spec/models/form/question_spec.rb
index 2d166b73b..5d747311c 100644
--- a/spec/models/form/question_spec.rb
+++ b/spec/models/form/question_spec.rb
@@ -169,17 +169,5 @@ RSpec.describe Form::Question, type: :model do
expect(question.completed?(case_log)).to be(true)
end
end
-
- context "when the gdpr acceptance is No" do
- let(:section_id) { "setup" }
- let(:subsection_id) { "setup" }
- let(:page_id) { "gdpr_acceptance" }
- let(:question_id) { "gdpr_acceptance" }
-
- it "returns false" do
- case_log["gdpr_acceptance"] = "No"
- expect(question.completed?(case_log)).to be(false)
- end
- end
end
end
diff --git a/spec/models/form/subsection_spec.rb b/spec/models/form/subsection_spec.rb
index f48c3ef4d..6bb2a36e2 100644
--- a/spec/models/form/subsection_spec.rb
+++ b/spec/models/form/subsection_spec.rb
@@ -77,16 +77,6 @@ RSpec.describe Form::Subsection, type: :model do
end
end
- context "when the privacy notice has not been shown" do
- let(:section_id) { "setup" }
- let(:subsection_id) { "setup" }
- let(:case_log) { FactoryBot.build(:case_log, :about_completed, gdpr_acceptance: "No") }
-
- it "does not mark the section as completed" do
- expect(sub_section.status(case_log)).to eq(:in_progress)
- end
- end
-
context "with a completed case log" do
let(:case_log) { FactoryBot.build(:case_log, :completed) }
diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb
index 94a6e9f9f..932ebdc75 100644
--- a/spec/models/form_handler_spec.rb
+++ b/spec/models/form_handler_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe FormHandler do
form_handler = described_class.instance
form = form_handler.get_form(test_form_name)
expect(form).to be_a(Form)
- expect(form.pages.count).to eq(29)
+ expect(form.pages.count).to eq(28)
end
end
diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb
index 4ab1b6ada..93bca44c3 100644
--- a/spec/models/form_spec.rb
+++ b/spec/models/form_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe Form, type: :model do
describe "next_incomplete_section_redirect_path" do
let(:case_log) { FactoryBot.build(:case_log, :in_progress) }
let(:subsection) { form.get_subsection("household_characteristics") }
- let(:later_subsection) { form.get_subsection("setup") }
+ let(:later_subsection) { form.get_subsection("declaration") }
context "when a user is on the check answers page for a subsection" do
def answer_household_needs(case_log)
@@ -85,10 +85,6 @@ RSpec.describe Form, type: :model do
case_log.mrcdate = Time.zone.parse("03/11/2019")
end
- def answer_local_gdpr_acceptance(case_log)
- case_log.gdpr_acceptance = "Yes"
- end
-
before do
case_log.tenant_code = "123"
case_log.age1 = 35
@@ -111,15 +107,14 @@ RSpec.describe Form, type: :model do
expect(form.next_incomplete_section_redirect_path(subsection, case_log)).to eq("tenancy-code")
end
- it "returns the next incomplete section by cycling back around if next subsections are completed" do
- answer_local_gdpr_acceptance(case_log)
- expect(form.next_incomplete_section_redirect_path(later_subsection, case_log)).to eq("armed-forces")
- end
-
it "returns the declaration section for a completed case log" do
expect(form.next_incomplete_section_redirect_path(subsection, completed_case_log)).to eq("declaration")
end
+ it "returns the next incomplete section by cycling back around if next subsections are completed" do
+ expect(form.next_incomplete_section_redirect_path(later_subsection, case_log)).to eq("armed-forces")
+ end
+
it "returns the declaration section if all sections are complete but the case log is in progress" do
answer_household_needs(case_log)
answer_tenancy_information(case_log)
@@ -128,7 +123,6 @@ RSpec.describe Form, type: :model do
answer_income_and_benefits(case_log)
answer_rent_and_charges(case_log)
answer_local_authority(case_log)
- answer_local_gdpr_acceptance(case_log)
expect(form.next_incomplete_section_redirect_path(subsection, case_log)).to eq("declaration")
end
diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb
index 9fef47719..09f14089e 100644
--- a/spec/requests/case_logs_controller_spec.rb
+++ b/spec/requests/case_logs_controller_spec.rb
@@ -200,7 +200,7 @@ RSpec.describe CaseLogsController, type: :request do
end
it "displays a section status for a case log" do
- assert_select ".govuk-tag", text: /Not started/, count: 9
+ assert_select ".govuk-tag", text: /Not started/, count: 8
assert_select ".govuk-tag", text: /Completed/, count: 0
assert_select ".govuk-tag", text: /Cannot start yet/, count: 1
end
@@ -222,7 +222,7 @@ RSpec.describe CaseLogsController, type: :request do
end
it "displays a section status for a case log" do
- assert_select ".govuk-tag", text: /Not started/, count: 8
+ assert_select ".govuk-tag", text: /Not started/, count: 7
assert_select ".govuk-tag", text: /Completed/, count: 1
assert_select ".govuk-tag", text: /Cannot start yet/, count: 1
end