From b84fcaf19515d6a598e044723173711e1112a4b3 Mon Sep 17 00:00:00 2001 From: JG Date: Mon, 27 Jun 2022 12:35:14 +0100 Subject: [PATCH] checking the back functionality for secondary group --- spec/features/schemes_spec.rb | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 1280e7700..88594f369 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -475,17 +475,33 @@ RSpec.describe "Schemes scheme Features" do end end - it "allows changing secondary-client-group question" do - click_link("Change", href: "/schemes/#{scheme.id}/secondary-client-group?check_answers=true") - expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group?check_answers=true") + context "changing secondary-client-group question" do + before do + click_link("Change", href: "/schemes/#{scheme.id}/secondary-client-group?check_answers=true") + end - choose "People at risk of domestic violence" - click_button "Save and continue" + it "allows changing secondary-client-group question" do + expect(page).to have_current_path("/schemes/#{scheme.id}/secondary-client-group?check_answers=true") - expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") - expect(page).to have_content "People at risk of domestic violence" - end + choose "People at risk of domestic violence" + click_button "Save and continue" + + expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") + expect(page).to have_content "People at risk of domestic violence" + end + context "when I press the back button" do + before do + click_link "Back" + end + + it "lets me select the support answers" do + expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") + expect(page).to have_content "Check your changes before updating this scheme" + end + end + + end it "allows changing support questions" do click_link("Change", href: "/schemes/#{scheme.id}/support?check_answers=true", match: :first) expect(page).to have_current_path("/schemes/#{scheme.id}/support?check_answers=true")