diff --git a/app/helpers/tasklist_helper.rb b/app/helpers/tasklist_helper.rb index 1b4d5b329..549ef2d22 100644 --- a/app/helpers/tasklist_helper.rb +++ b/app/helpers/tasklist_helper.rb @@ -37,11 +37,12 @@ module TasklistHelper end def get_first_page_or_check_answers(subsection, case_log, form, questions) - if is_started?(subsection, case_log, questions) - send("case_log_#{subsection}_check_answers_path", case_log) - else - send("case_log_#{form.first_page_for_subsection(subsection)}_path", case_log) - end + path = if is_started?(subsection, case_log, questions) + "case_log_#{subsection}_check_answers_path" + else + "case_log_#{form.first_page_for_subsection(subsection)}_path" + end + send(path, case_log) end private diff --git a/spec/helpers/tasklist_helper_spec.rb b/spec/helpers/tasklist_helper_spec.rb index 836170a08..7078159cd 100644 --- a/spec/helpers/tasklist_helper_spec.rb +++ b/spec/helpers/tasklist_helper_spec.rb @@ -77,11 +77,11 @@ RSpec.describe TasklistHelper do let(:household_characteristics_questions) { form.questions_for_subsection("household_characteristics").keys } it "returns the check answers page path if the section has been started already" do - expect(get_first_page_or_check_answers('household_characteristics', case_log, form, household_characteristics_questions)).to match(/check_answers/) + expect(get_first_page_or_check_answers("household_characteristics", case_log, form, household_characteristics_questions)).to match(/check_answers/) end it "returns the first question page path for the section if it has not been started yet" do - expect(get_first_page_or_check_answers('household_characteristics', empty_case_log, form, household_characteristics_questions)).to match(/tenant_code/) + expect(get_first_page_or_check_answers("household_characteristics", empty_case_log, form, household_characteristics_questions)).to match(/tenant_code/) end end end