|
14 | 14 | end |
15 | 15 |
|
16 | 16 | 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 |
19 | 18 | config = GC.config({}) |
20 | | - # Can't set anything if there are no options. |
21 | | - skip if config.empty? |
22 | | - |
23 | 19 | # Try to find a boolean setting to reliably test changing it. |
24 | 20 | key, _value = config.find { |_k, v| v == true } |
25 | 21 | skip unless key |
|
29 | 25 | GC.config(key => true).should == config |
30 | 26 | GC.config[key].should == true |
31 | 27 | ensure |
32 | | - GC.config(config) |
| 28 | + GC.config(config.except(:implementation)) |
33 | 29 | end |
34 | 30 |
|
35 | 31 | 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 |
37 | 35 | end |
38 | 36 |
|
39 | 37 | 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 |
41 | 41 | end |
42 | 42 |
|
43 | 43 | it "raises an ArgumentError if options include global keys" do |
|
64 | 64 | end |
65 | 65 |
|
66 | 66 | after do |
67 | | - GC.config(@default_config) |
| 67 | + GC.config(@default_config.except(:implementation)) |
68 | 68 | end |
69 | 69 |
|
70 | 70 | it "includes :rgengc_allow_full_mark option, true by default" do |
|
75 | 75 | it "allows to set :rgengc_allow_full_mark" do |
76 | 76 | # This key maps truthy and falsey values to true and false. |
77 | 77 | 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) |
79 | 79 | end |
80 | 80 | end |
81 | 81 | end |
|
0 commit comments