Browse Source

Reset fields

pull/708/head
baarkerlounger 3 years ago
parent
commit
3494d3a6be
  1. 1
      app/controllers/form_controller.rb
  2. 2
      spec/features/form/form_navigation_spec.rb

1
app/controllers/form_controller.rb

@ -11,6 +11,7 @@ class FormController < ApplicationController
if mandatory_questions_with_no_response.empty? && @case_log.update(responses_for_page) if mandatory_questions_with_no_response.empty? && @case_log.update(responses_for_page)
session[:errors] = nil session[:errors] = nil
session[:fields] = nil
redirect_to(successful_redirect_path) redirect_to(successful_redirect_path)
else else
redirect_path = "case_log_#{@page.id}_path" redirect_path = "case_log_#{@page.id}_path"

2
spec/features/form/form_navigation_spec.rb

@ -139,7 +139,7 @@ RSpec.describe "Form Navigation" do
context "when the page has a main and conditional question" do context "when the page has a main and conditional question" do
context "when the conditional question is required but not answered" do context "when the conditional question is required but not answered" do
it "shows a validation error for the conditional question", js: true do it "shows a validation error for the conditional question" do
visit("/logs/#{id}/armed-forces") visit("/logs/#{id}/armed-forces")
choose("case-log-armedforces-1-field", allow_label_click: true) choose("case-log-armedforces-1-field", allow_label_click: true)
click_button("Save and continue") click_button("Save and continue")

Loading…
Cancel
Save