From d6518c252bc63f99cff735275ade519af219fbaa Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 3 Apr 2023 10:13:14 +0100 Subject: [PATCH] Return test routes from form handler --- app/models/form_handler.rb | 6 +++++- config/routes.rb | 13 ------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/models/form_handler.rb b/app/models/form_handler.rb index b2d9168b2..4895fff96 100644 --- a/app/models/form_handler.rb +++ b/app/models/form_handler.rb @@ -57,7 +57,11 @@ class FormHandler forms["current_lettings"] = Form.new(nil, current_collection_start_year, LETTINGS_SECTIONS, "lettings") if forms["current_lettings"].blank? forms["next_lettings"] = Form.new(nil, next_collection_start_year, LETTINGS_SECTIONS, "lettings") if forms["next_lettings"].blank? - forms + if Rails.env.test? + forms.merge({ fake_lettings_2021: Form.new("spec/fixtures/forms/2021_2022.json"), real_lettings_2021: Form.new("config/forms/2021_2022.json") }) + else + forms + end end def lettings_form_for_start_year(year) diff --git a/config/routes.rb b/config/routes.rb index e812d140a..eeadffa03 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -161,19 +161,6 @@ Rails.application.routes.draw do get "#{subsection.id.to_s.dasherize}/check-answers", to: "form#check_answers" end end - - if Rails.env.test? - [Form.new("spec/fixtures/forms/2021_2022.json"), - Form.new("config/forms/2021_2022.json")].each do |form| - form.pages.map do |page| - get page.id.to_s.dasherize, to: "form#show_page" - end - - form.subsections.map do |subsection| - get "#{subsection.id.to_s.dasherize}/check-answers", to: "form#check_answers" - end - end - end end resources :sales_logs, path: "/sales-logs" do