Skip to content

Commit c8a6beb

Browse files
trinistreregon
authored andcommitted
Fix spec for GC.config on Ruby 4.0
1 parent 713af0a commit c8a6beb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

core/gc/config_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@
1414
end
1515

1616
context "with a hash of options" do
17-
it "allows to set GC implementation's options" do
18-
# Remove global keys which are read-only.
17+
it "allows to set GC implementation's options, returning the new config" do
1918
config = GC.config({})
20-
# Can't set anything if there are no options.
21-
skip if config.empty?
22-
2319
# Try to find a boolean setting to reliably test changing it.
2420
key, _value = config.find { |_k, v| v == true }
2521
skip unless key
@@ -29,15 +25,19 @@
2925
GC.config(key => true).should == config
3026
GC.config[key].should == true
3127
ensure
32-
GC.config(config)
28+
GC.config(config.except(:implementation))
3329
end
3430

3531
it "does not change settings that aren't present in the hash" do
36-
GC.config({}).should == GC.config.except(:implementation)
32+
previous = GC.config
33+
GC.config({})
34+
GC.config.should == previous
3735
end
3836

3937
it "ignores unknown keys" do
40-
GC.config(foo: "bar").should == GC.config.except(:implementation)
38+
previous = GC.config
39+
GC.config(foo: "bar")
40+
GC.config.should == previous
4141
end
4242

4343
it "raises an ArgumentError if options include global keys" do
@@ -64,7 +64,7 @@
6464
end
6565

6666
after do
67-
GC.config(@default_config)
67+
GC.config(@default_config.except(:implementation))
6868
end
6969

7070
it "includes :rgengc_allow_full_mark option, true by default" do
@@ -75,7 +75,7 @@
7575
it "allows to set :rgengc_allow_full_mark" do
7676
# This key maps truthy and falsey values to true and false.
7777
GC.config(rgengc_allow_full_mark: nil).should == @default_config.merge(rgengc_allow_full_mark: false)
78-
GC.config(rgengc_allow_full_mark: 1.23).should == @default_config
78+
GC.config(rgengc_allow_full_mark: 1.23).should == @default_config.merge(rgengc_allow_full_mark: true)
7979
end
8080
end
8181
end

0 commit comments

Comments
 (0)