From 6d0291f1d8669a0f46ab0ac7f1e814f41fb05192 Mon Sep 17 00:00:00 2001 From: JG Date: Tue, 5 Jul 2022 10:19:18 +0100 Subject: [PATCH] testing new scheme for a different org for coordinator --- spec/requests/locations_controller_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index 5839d3eb4..da3075f43 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -40,6 +40,15 @@ RSpec.describe LocationsController, type: :request do expect(response).to have_http_status(:ok) expect(page).to have_content("Add a location to this scheme") end + + context "when trying to new location to a scheme that belongs to another organisation" do + let(:another_scheme) { FactoryBot.create(:scheme) } + + it "displays the new page with an error message" do + get "/schemes/#{another_scheme.id}/location/new" + expect(response).to have_http_status(:not_found) + end + end end context "when signed in as a support user" do