Browse Source

Fix back button for check answers pages

pull/72/head
baarkerlounger 4 years ago
parent
commit
0264baf6dc
  1. 1
      app/controllers/case_logs_controller.rb
  2. 9
      spec/features/case_log_spec.rb

1
app/controllers/case_logs_controller.rb

@ -153,6 +153,7 @@ private
def get_previous_page_path(form, current_page, case_log = {})
return case_log.previous_page if case_log.previous_page
return request.referer.split("/")[-2..-1].join("/") if request.referer&.ends_with?("check_answers")
return form.previous_page(current_page) if current_page
end
end

9
spec/features/case_log_spec.rb

@ -229,6 +229,15 @@ RSpec.describe "Test Features" do
expect(page).to have_current_path("/case_logs/#{id}/#{pages[index + 1]}")
end
end
context "when changing an answer from the check answers page" do
it "the back button routes correctly" do
visit("/case_logs/#{id}/household_characteristics/check_answers")
first("a", text: /Answer/).click
click_link("Back")
expect(page).to have_current_path("/case_logs/#{id}/household_characteristics/check_answers")
end
end
end
end

Loading…
Cancel
Save