Browse Source

feature tests passing

pull/704/head
JG 3 years ago
parent
commit
9ce3e2ece1
  1. 4
      app/controllers/locations_controller.rb
  2. 4
      spec/features/schemes_spec.rb

4
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

4
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

Loading…
Cancel
Save