Skip to content

Commit 8f6ee64

Browse files
committed
Fix skips in Active Support
The change to serialization mirrors the test just below it that also uses a conditional for the assertion instead of a skip. The conditional is necessary because memcached entries are not strings. The class_serial test should not run on Ruby 3.2+ because class_serial was replaced with Object Shapes. The class_serial value in RubyVM.stat was removed in ruby/ruby@13bd617
1 parent 3d002c1 commit 8f6ee64

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

activesupport/test/cache/behaviors/cache_store_format_version_behavior.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ module CacheStoreFormatVersionBehavior
4747
lookup_store.send(:serialize_entry, ActiveSupport::Cache::Entry.new(["value"] * 100))
4848
end
4949

50-
skip if !serialized.is_a?(String)
51-
52-
assert_operator serialized, :start_with?, uncompressed_signature
50+
if serialized.is_a?(String)
51+
assert_operator serialized, :start_with?, uncompressed_signature
52+
end
5353
end
5454

5555
test "format version #{format_version.inspect} uses correct signature for compressed entries" do

activesupport/test/executor_test.rb

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -225,31 +225,33 @@ def test_hook_insertion_order
225225
assert_equal [:state_a, :state_b, :state_d, :state_c], supplied_state
226226
end
227227

228-
def test_class_serial_is_unaffected
229-
skip if !defined?(RubyVM) || !RubyVM.stat.has_key?(:class_serial)
228+
if RUBY_VERSION < "3.2"
229+
def test_class_serial_is_unaffected
230+
skip if !defined?(RubyVM) || !RubyVM.stat.has_key?(:class_serial)
230231

231-
hook = Class.new do
232-
define_method(:run) do
233-
nil
234-
end
232+
hook = Class.new do
233+
define_method(:run) do
234+
nil
235+
end
235236

236-
define_method(:complete) do |state|
237-
nil
238-
end
239-
end.new
237+
define_method(:complete) do |state|
238+
nil
239+
end
240+
end.new
240241

241-
executor.register_hook(hook)
242+
executor.register_hook(hook)
242243

243-
# Warm-up to trigger any pending autoloads
244-
executor.wrap { }
244+
# Warm-up to trigger any pending autoloads
245+
executor.wrap { }
245246

246-
before = RubyVM.stat(:class_serial)
247-
executor.wrap { }
248-
executor.wrap { }
249-
executor.wrap { }
250-
after = RubyVM.stat(:class_serial)
247+
before = RubyVM.stat(:class_serial)
248+
executor.wrap { }
249+
executor.wrap { }
250+
executor.wrap { }
251+
after = RubyVM.stat(:class_serial)
251252

252-
assert_equal before, after
253+
assert_equal before, after
254+
end
253255
end
254256

255257
def test_separate_classes_can_wrap

0 commit comments

Comments
 (0)