Browse Source

Return test routes from form handler

further-bulk-upload-year-fixes
Kat 2 years ago
parent
commit
d6518c252b
  1. 6
      app/models/form_handler.rb
  2. 13
      config/routes.rb

6
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["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["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 end
def lettings_form_for_start_year(year) def lettings_form_for_start_year(year)

13
config/routes.rb

@ -161,19 +161,6 @@ Rails.application.routes.draw do
get "#{subsection.id.to_s.dasherize}/check-answers", to: "form#check_answers" get "#{subsection.id.to_s.dasherize}/check-answers", to: "form#check_answers"
end end
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 end
resources :sales_logs, path: "/sales-logs" do resources :sales_logs, path: "/sales-logs" do

Loading…
Cancel
Save