Browse Source

Allow navigating to question if the collection is still open for editing

pull/1716/head
Kat 2 years ago
parent
commit
df345b449b
  1. 2
      app/controllers/form_controller.rb
  2. 7
      spec/requests/lettings_logs_controller_spec.rb

2
app/controllers/form_controller.rb

@ -208,7 +208,7 @@ private
def check_collection_period def check_collection_period
return unless @log 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 end
CONFIRMATION_PAGE_IDS = %w[uprn_confirmation].freeze CONFIRMATION_PAGE_IDS = %w[uprn_confirmation].freeze

7
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: {} get "/lettings-logs/#{completed_lettings_log.id}/income-and-benefits/check-answers", headers: { "Accept" => "text/html" }, params: {}
expect(page).to have_link("Change") expect(page).to have_link("Change")
end 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 end
it "does not let the user navigate to questions for previous collection year logs" do 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" } } let(:headers) { { "Accept" => "text/html" } }
before do 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) allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user sign_in user
end end

Loading…
Cancel
Save