diff --git a/spec/features/schemes_helpers.rb b/spec/features/schemes_helpers.rb index 2cd48acf6..9ce6a109a 100644 --- a/spec/features/schemes_helpers.rb +++ b/spec/features/schemes_helpers.rb @@ -55,45 +55,17 @@ module SchemesHelpers end def fill_in_and_save_location - fill_in_and_save_postcode - fill_in_and_save_local_authority - fill_in_and_save_name - fill_in_and_save_units - fill_in_and_save_type_of_unit - fill_in_and_save_mobility_standards - fill_in_and_save_availability - end - - def fill_in_and_save_postcode fill_in with: "AA11AA" click_button "Save and continue" - end - - def fill_in_and_save_local_authority fill_in with: "Adur" - end - - def fill_in_and_save_name fill_in with: "Some name" click_button "Save and continue" - end - - def fill_in_and_save_units fill_in with: 5 click_button "Save and continue" - end - - def fill_in_and_save_type_of_unit choose "Self-contained house" click_button "Save and continue" - end - - def fill_in_and_save_mobility_standards choose "location-mobility-type-none-field" click_button "Save and continue" - end - - def fill_in_and_save_availability fill_in "Day", with: 2 fill_in "Month", with: 2 fill_in "Year", with: 2022 @@ -101,13 +73,21 @@ module SchemesHelpers end def fill_in_and_save_second_location - fill_in "Postcode", with: "AA12AA" - fill_in "Location name (optional)", with: "Other name" - fill_in "Total number of units at this location", with: 2 + fill_in with: "AA12AA" + click_button "Save and continue" + fill_in with: "Adur" + fill_in with: "Other name" + click_button "Save and continue" + fill_in with: 2 + click_button "Save and continue" choose "Self-contained house" - choose "location-add-another-location-no-field" + click_button "Save and continue" choose "location-mobility-type-none-field" click_button "Save and continue" + fill_in "Day", with: 2 + fill_in "Month", with: 2 + fill_in "Year", with: 2022 + click_button "Save and continue" end def create_and_save_a_scheme diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index b1cffd3bf..081f90e45 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -42,6 +42,7 @@ RSpec.describe LocationsController, type: :request do end it "returns a template for a new location" do + follow_redirect! expect(response).to have_http_status(:ok) expect(page).to have_content("Add a location to this scheme") end @@ -64,6 +65,7 @@ RSpec.describe LocationsController, type: :request do end it "returns a template for a new location" do + follow_redirect! expect(response).to have_http_status(:ok) expect(page).to have_content("Add a location to this scheme") end diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 4de927f8f..045d39981 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -813,6 +813,7 @@ RSpec.describe SchemesController, type: :request do let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support" } } } it "renders add location to this scheme successful update" do + follow_redirect! follow_redirect! expect(response).to have_http_status(:ok) expect(page).to have_content("Add a location to this scheme") @@ -1096,6 +1097,7 @@ RSpec.describe SchemesController, type: :request do let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support" } } } it "renders confirm secondary group after successful update" do + follow_redirect! follow_redirect! expect(response).to have_http_status(:ok) expect(page).to have_content("Add a location to this scheme")