Move testing setup for path-based tenanting into test helper

This was previously in the AR::Tenanted branch we were using, but
feels like it doesn't belong in the gem.
This commit is contained in:
Mike Dalessio
2025-08-10 18:49:52 -04:00
parent e5bedcee99
commit 360e22feb0
3 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ gem "stimulus-rails"
gem "turbo-rails"
# Deployment and drivers
gem "active_record-tenanted", bc: "active_record-tenanted", branch: "flavorjones/path-based-tenanting"
gem "active_record-tenanted", bc: "active_record-tenanted"
gem "bootsnap", require: false
gem "kamal", bc: "kamal", ref: "344e2d79", require: false
gem "puma", ">= 5.0"
+1 -2
View File
@@ -7,8 +7,7 @@ GIT
GIT
remote: https://github.com/basecamp/active_record-tenanted
revision: 8e33088cdbd69ab7b4cf4100d4202a54aa97e4c0
branch: flavorjones/path-based-tenanting
revision: 4e4c5b8d7d293780b5b00ef893b3226da5e1fe33
specs:
active_record-tenanted (0.1.0)
activerecord (>= 8.1.alpha)
+12
View File
@@ -42,6 +42,18 @@ module ActiveSupport
end
end
class ActionDispatch::IntegrationTest
setup do
integration_session.default_url_options[:script_name] = "/#{ApplicationRecord.current_tenant}"
end
end
class ActionDispatch::SystemTestCase
setup do
self.default_url_options[:script_name] = "/#{ApplicationRecord.current_tenant}"
end
end
RubyLLM.configure do |config|
config.openai_api_key ||= "DUMMY-TEST-KEY" # Run tests with VCR without having to configure OpenAI API key locally.
end