From 6b99ac7c561db5113944535869dde7c6d7b5ed9f Mon Sep 17 00:00:00 2001 From: JG Date: Fri, 1 Jul 2022 06:57:42 +0100 Subject: [PATCH] testing back from new location --- app/views/locations/new.html.erb | 7 +++---- spec/features/schemes_spec.rb | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb index f867d1916..1541d5b25 100644 --- a/app/views/locations/new.html.erb +++ b/app/views/locations/new.html.erb @@ -2,9 +2,9 @@ <% content_for :before_content do %> <%= govuk_back_link( - text: "Back", - href: "javascript:history.go(-1);", - ) %> + text: "Back", + href: "/schemes/#{@scheme.id}/support" + ) %> <% end %> <%= render partial: "organisations/headings", locals: { main: "Add a location to this scheme", sub: @scheme.service_name } %> @@ -57,7 +57,6 @@ inline: true, legend: { text: "Do you want to add another location?", size: "m" } %> - <%= f.govuk_submit "Save and continue" %> diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index c793c617b..36060461c 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -379,12 +379,32 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_content "Add a location to this scheme" end + context "when I press the back button" do + before do + click_link "Back" + end + + it "lets me select the secondary group" do + expect(page).to have_current_path("/schemes/#{scheme.id}/support") + expect(page).to have_content "What support does this scheme provide?" + end + + context "when we amend support" do + it "returns to the add location page" do + click_button "Save and continue" + expect(page).to have_current_path("/schemes/#{scheme.id}/location/new") + end + end + end + context "when I add location to the scheme" do before do fill_in "Postcode", with: "SW1P 4DF" - fill_in "Name(optional)", with: "Some name" + fill_in "Name (optional)", with: "Some name" fill_in "Total number of units at this location", with: 1 choose "Self-contained house" + choose "location-wheelchair-adaptation-no-field" + choose "location-add-another-location-no-field" click_button "Save and continue" end @@ -410,10 +430,6 @@ RSpec.describe "Schemes scheme Features" do context "when changing answers" do end end - - # it "lets me check my answers" do - # expect(page).to have_content "Check your changes before creating this scheme" - # end end end end