From df345b449b8dd364f5e29aeda8de61589281b311 Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 21 Jun 2023 16:06:09 +0100 Subject: [PATCH] Allow navigating to question if the collection is still open for editing --- app/controllers/form_controller.rb | 2 +- spec/requests/lettings_logs_controller_spec.rb | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 0219b3c57..15ff12d8b 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -208,7 +208,7 @@ private def check_collection_period return unless @log - redirect_to lettings_log_path(@log) unless @log.collection_period_open? + redirect_to lettings_log_path(@log) unless @log.collection_period_open_for_editing? end CONFIRMATION_PAGE_IDS = %w[uprn_confirmation].freeze diff --git a/spec/requests/lettings_logs_controller_spec.rb b/spec/requests/lettings_logs_controller_spec.rb index 084d32bec..9b62ed37c 100644 --- a/spec/requests/lettings_logs_controller_spec.rb +++ b/spec/requests/lettings_logs_controller_spec.rb @@ -1111,6 +1111,11 @@ RSpec.describe LettingsLogsController, type: :request do get "/lettings-logs/#{completed_lettings_log.id}/income-and-benefits/check-answers", headers: { "Accept" => "text/html" }, params: {} expect(page).to have_link("Change") end + + it "lets the user navigate to questions for previous collection year logs" do + get "/lettings-logs/#{completed_lettings_log.id}/needs-type", headers: { "Accept" => "text/html" }, params: {} + expect(response).to have_http_status(:ok) + end end it "does not let the user navigate to questions for previous collection year logs" do @@ -1216,7 +1221,7 @@ RSpec.describe LettingsLogsController, type: :request do let(:headers) { { "Accept" => "text/html" } } before do - allow(affected_lettings_log.form).to receive(:new_logs_end_date).and_return(Time.zone.today + 1.day) + allow(affected_lettings_log.form).to receive(:edit_end_date).and_return(Time.zone.today + 1.day) allow(user).to receive(:need_two_factor_authentication?).and_return(false) sign_in user end