summaryrefslogtreecommitdiff
path: root/spec/ruby/core/gc/auto_compact_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/gc/auto_compact_spec.rb')
-rw-r--r--spec/ruby/core/gc/auto_compact_spec.rb21
1 files changed, 11 insertions, 10 deletions
diff --git a/spec/ruby/core/gc/auto_compact_spec.rb b/spec/ruby/core/gc/auto_compact_spec.rb
index d77ed44452..96e7d3923c 100644
--- a/spec/ruby/core/gc/auto_compact_spec.rb
+++ b/spec/ruby/core/gc/auto_compact_spec.rb
@@ -2,18 +2,19 @@ require_relative '../../spec_helper'
ruby_version_is "3.0" do
describe "GC.auto_compact" do
- before :each do
- @default = GC.auto_compact
- end
-
- after :each do
- GC.auto_compact = @default
- end
-
it "can set and get a boolean value" do
original = GC.auto_compact
- GC.auto_compact = !original
- GC.auto_compact.should == !original
+ begin
+ GC.auto_compact = !original
+ rescue NotImplementedError # platform does not support autocompact
+ skip
+ end
+
+ begin
+ GC.auto_compact.should == !original
+ ensure
+ GC.auto_compact = original
+ end
end
end
end