From 9e63b3bc3db9322fc8928771e820503058b95fdc Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 09:41:43 +0900 Subject: [PATCH] Add test for #234: no AR default_timezone deprecation warning Capture deprecation warnings emitted while resolving plsql.default_timezone with `activerecord_class` set, and assert that no warning mentioning `default_timezone` was raised. The test_gemfiles workflow exercises every supported ActiveRecord version (5.0 through 8.0), so this test will catch any future regression that re-introduces a call to the deprecated per-class `default_timezone` accessor on AR 7.0/7.1. Co-Authored-By: Claude Opus 4.6 (1M context) --- spec/plsql/schema_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/plsql/schema_spec.rb b/spec/plsql/schema_spec.rb index 0662882b..e8523f01 100644 --- a/spec/plsql/schema_spec.rb +++ b/spec/plsql/schema_spec.rb @@ -218,6 +218,24 @@ class TestModel < TestBaseModel expect(plsql.default_timezone).to eq(:utc) end + it "should not emit ActiveRecord::Base.default_timezone deprecation warning (#234)" do + skip "ActiveRecord.default_timezone is not available" unless ActiveRecord.respond_to?(:default_timezone=) + + ActiveRecord.default_timezone = :utc + + deprecator = ActiveRecord.respond_to?(:deprecator) ? ActiveRecord.deprecator : ActiveSupport::Deprecation + original_behavior = deprecator.behavior + warnings = [] + begin + deprecator.behavior = ->(message, *) { warnings << message } + expect(plsql.default_timezone).to eq(:utc) + ensure + deprecator.behavior = original_behavior + end + + expect(warnings.grep(/default_timezone/)).to be_empty + end + it "should have the same connection as default schema" do expect(plsql.hr.connection).to eq(plsql.connection) end