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