From 360e22feb02fc83c55a68612215c9b6447e91b75 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Sun, 10 Aug 2025 18:49:52 -0400 Subject: [PATCH] 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. --- Gemfile | 2 +- Gemfile.lock | 3 +-- test/test_helper.rb | 12 ++++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 91833adba..87a4a1367 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index 6051dac71..f50947b55 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/test/test_helper.rb b/test/test_helper.rb index 1fe5ac9a1..d68021462 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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