Browse Source

remove unused code from get next page path

pull/49/head
Kat 4 years ago
parent
commit
663f8cff2a
  1. 13
      app/controllers/case_logs_controller.rb
  2. 6
      spec/features/case_log_spec.rb

13
app/controllers/case_logs_controller.rb

@ -132,7 +132,8 @@ private
def get_next_page_path(form, previous_page, responses_for_page = {})
questions_for_page = form.questions_for_page(previous_page)
questions_for_page.each do |question, content|
if content.key?("conditional_route_to")
next unless content.key?("conditional_route_to")
content["conditional_route_to"].each do |route, answer|
if responses_for_page[question].present? && answer.include?(responses_for_page[question])
return "case_log_#{route}_path"
@ -140,16 +141,6 @@ private
end
end
next unless content.key?("next_page")
next_page = content["next_page"]
if next_page == "check_answers"
subsection = form.subsection_for_page(previous_page)
return "case_log_#{subsection}_check_answers_path"
end
return "case_log_#{content[]}_path"
end
form.next_page_redirect_path(previous_page)
end
end

6
spec/features/case_log_spec.rb

@ -351,5 +351,11 @@ RSpec.describe "Test Features" do
click_button("Save and continue")
expect(page).to have_current_path("/case_logs/#{id}/conditional_question/check_answers")
end
it "can route to the default next page" do
visit("/case_logs/#{id}/conditional_question")
click_button("Save and continue")
expect(page).to have_current_path("/case_logs/#{id}/conditional_question/check_answers")
end
end
end

Loading…
Cancel
Save