diff --git a/config/application.rb b/config/application.rb index 82c552a05..554a525dc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -48,6 +48,7 @@ module Consul # Handle custom exceptions config.action_dispatch.rescue_responses["FeatureFlags::FeatureDisabled"] = :forbidden + config.action_dispatch.rescue_responses["Apartment::TenantNotFound"] = :not_found # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local diff --git a/spec/system/multitenancy_spec.rb b/spec/system/multitenancy_spec.rb index 188764ad9..bc92dc60e 100644 --- a/spec/system/multitenancy_spec.rb +++ b/spec/system/multitenancy_spec.rb @@ -173,4 +173,12 @@ describe "Multitenancy", :seed_tenants do expect(page).not_to have_css "html.tenant-public" end end + + scenario "Shows the not found page when accessing a non-existing tenant", :show_exceptions do + with_subdomain("jupiter") do + visit root_path + + expect(page).to have_title "Not found" + end + end end