|
23 | 23 | string.should include('"value":"abc"')
|
24 | 24 | end
|
25 | 25 |
|
26 |
| - it "dumps to a temporary file when passed output: :file" do |
27 |
| - file = ObjectSpace.dump("abc", output: :file) |
28 |
| - file.should be_kind_of(File) |
| 26 | + ruby_version_is "3.0" do |
| 27 | + it "dumps to a temporary file when passed output: :file" do |
| 28 | + file = ObjectSpace.dump("abc", output: :file) |
| 29 | + file.should be_kind_of(File) |
29 | 30 |
|
30 |
| - file.rewind |
31 |
| - content = file.read |
32 |
| - content.should include('"value":"abc"') |
33 |
| - ensure |
34 |
| - file.close |
35 |
| - File.unlink file.path |
36 |
| - end |
| 31 | + file.rewind |
| 32 | + content = file.read |
| 33 | + content.should include('"value":"abc"') |
| 34 | + ensure |
| 35 | + file.close |
| 36 | + File.unlink file.path |
| 37 | + end |
37 | 38 |
|
38 |
| - it "dumps to a temporary file when passed output: :nil" do |
39 |
| - file = ObjectSpace.dump("abc", output: nil) |
40 |
| - file.should be_kind_of(File) |
| 39 | + it "dumps to a temporary file when passed output: :nil" do |
| 40 | + file = ObjectSpace.dump("abc", output: nil) |
| 41 | + file.should be_kind_of(File) |
41 | 42 |
|
42 |
| - file.rewind |
43 |
| - file.read.should include('"value":"abc"') |
44 |
| - ensure |
45 |
| - file.close |
46 |
| - File.unlink file.path |
| 43 | + file.rewind |
| 44 | + file.read.should include('"value":"abc"') |
| 45 | + ensure |
| 46 | + file.close |
| 47 | + File.unlink file.path |
| 48 | + end |
47 | 49 | end
|
48 | 50 |
|
49 | 51 | it "dumps to stdout when passed output: :stdout" do
|
50 | 52 | stdout = ruby_exe('ObjectSpace.dump("abc", output: :stdout)', options: "-robjspace").chomp
|
51 | 53 | stdout.should include('"value":"abc"')
|
52 | 54 | end
|
53 | 55 |
|
54 |
| - it "dumps to provided IO when passed output: IO" do |
55 |
| - filename = tmp("io_read.txt") |
56 |
| - io = File.open(filename, "w+") |
57 |
| - result = ObjectSpace.dump("abc", output: io) |
58 |
| - result.should.equal? io |
| 56 | + ruby_version_is "3.0" do |
| 57 | + it "dumps to provided IO when passed output: IO" do |
| 58 | + filename = tmp("io_read.txt") |
| 59 | + io = File.open(filename, "w+") |
| 60 | + result = ObjectSpace.dump("abc", output: io) |
| 61 | + result.should.equal? io |
59 | 62 |
|
60 |
| - io.rewind |
61 |
| - io.read.should include('"value":"abc"') |
62 |
| - ensure |
63 |
| - io.close |
64 |
| - rm_r filename |
| 63 | + io.rewind |
| 64 | + io.read.should include('"value":"abc"') |
| 65 | + ensure |
| 66 | + io.close |
| 67 | + rm_r filename |
| 68 | + end |
65 | 69 | end
|
66 | 70 |
|
67 | 71 | it "raises ArgumentError when passed not supported :output value" do
|
|
0 commit comments