From 936aec30047df31e34ec7200acb6df59f627b871 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 7 May 2024 01:05:33 +0900 Subject: [PATCH] Ruby 3.2 deprecates `double_heap` option to `GC.verify_compaction_references` (#1365) This commit uses newly supported `expand_heap` option if Ruby version is 3.2 or higher. - Warning message fixed by this commit: ``` $ bundle exec rake spec ... snip ... :286: warning: double_heap is deprecated, please use expand_heap instead ... snip ... ``` Refer to https://github.com/ruby/ruby/commit/a6dd859affc42b667279e513bb94fb75cfb133c1 --- spec/spec_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2e924eb4..677c3482 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,11 @@ if GC.respond_to?(:verify_compaction_references) # This method was added in Ruby 3.0.0. Calling it this way asks the GC to # move objects around, helping to find object movement bugs. - GC.verify_compaction_references(double_heap: true, toward: :empty) + if RUBY_VERSION >= "3.2" + GC.verify_compaction_references(expand_heap: true, toward: :empty) + else + GC.verify_compaction_references(double_heap: true, toward: :empty) + end end RSpec.configure do |config|