From 9ce3e2ece130d8f5414d2d0e58579cb93f9057d2 Mon Sep 17 00:00:00 2001 From: JG Date: Tue, 5 Jul 2022 14:41:38 +0100 Subject: [PATCH] feature tests passing --- app/controllers/locations_controller.rb | 4 ++-- spec/features/schemes_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb index ab6b322ac..f28fcef6a 100644 --- a/app/controllers/locations_controller.rb +++ b/app/controllers/locations_controller.rb @@ -2,7 +2,7 @@ class LocationsController < ApplicationController include Pagy::Backend before_action :authenticate_user! before_action :authenticate_scope! - before_action :find_location, except: %i[new create] + before_action :find_location, except: %i[new create index] before_action :find_scheme before_action :authenticate_action! @@ -38,7 +38,7 @@ class LocationsController < ApplicationController private def find_scheme - @scheme = if %w[new create].include?(action_name) + @scheme = if %w[new create index].include?(action_name) Scheme.find(params[:id]) else @location.scheme diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 7c518d1a0..98647a193 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -392,7 +392,7 @@ RSpec.describe "Schemes scheme Features" do context "when I 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") + expect(page).to have_current_path("/schemes/#{scheme.id}/locations/new") end end end @@ -626,7 +626,7 @@ RSpec.describe "Schemes scheme Features" do choose "Medium stay" click_button "Save and continue" - expect(page).to have_current_path("/schemes/#{scheme.id}/location/new") + expect(page).to have_current_path("/schemes/#{scheme.id}/locations/new") expect(page).to have_content "Add a location to this scheme" end