Skip to content

Commit db0561d

Browse files
yahondaclaude
andcommitted
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) <noreply@anthropic.com>
1 parent 556cd30 commit db0561d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

spec/plsql/schema_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,24 @@ class TestModel < TestBaseModel
218218
expect(plsql.default_timezone).to eq(:utc)
219219
end
220220

221+
it "should not emit ActiveRecord::Base.default_timezone deprecation warning (#234)" do
222+
skip "ActiveRecord.default_timezone is not available" unless ActiveRecord.respond_to?(:default_timezone=)
223+
224+
ActiveRecord.default_timezone = :utc
225+
226+
deprecator = ActiveRecord.respond_to?(:deprecator) ? ActiveRecord.deprecator : ActiveSupport::Deprecation
227+
original_behavior = deprecator.behavior
228+
warnings = []
229+
begin
230+
deprecator.behavior = ->(message, *) { warnings << message }
231+
expect(plsql.default_timezone).to eq(:utc)
232+
ensure
233+
deprecator.behavior = original_behavior
234+
end
235+
236+
expect(warnings.grep(/default_timezone/)).to be_empty
237+
end
238+
221239
it "should have the same connection as default schema" do
222240
expect(plsql.hr.connection).to eq(plsql.connection)
223241
end

0 commit comments

Comments
 (0)