Skip to content

Commit 40c367b

Browse files
committed
Small refactor of specs.
1 parent 19e2552 commit 40c367b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

spec/ruby/optional/capi/io_spec.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,24 +381,23 @@
381381
@o = CApiIOSpecs.new
382382
@name = tmp("c_api_rb_io_specs")
383383
touch @name
384-
385-
@io = nil
386384
end
387385

388386
after :each do
389-
@io.close unless @io.nil? || @io.closed?
390387
rm_r @name
391388
end
392389

393-
it "Has the sync flag set if the IO object is synced in Ruby" do
394-
@io = File.open(@name)
395-
@io.sync = true
396-
@o.rb_io_mode_sync_flag(@io).should == true
390+
it "has the sync flag set if the IO object is synced in Ruby" do
391+
File.open(@name) { |io|
392+
io.sync = true
393+
@o.rb_io_mode_sync_flag(io).should == true
394+
}
397395
end
398396

399-
it "Has the sync flag unset if the IO object is not synced in Ruby" do
400-
@io = File.open(@name)
401-
@io.sync = false
402-
@o.rb_io_mode_sync_flag(@io).should == false
397+
it "has the sync flag unset if the IO object is not synced in Ruby" do
398+
File.open(@name) { |io|
399+
io.sync = false
400+
@o.rb_io_mode_sync_flag(io).should == false
401+
}
403402
end
404403
end

0 commit comments

Comments
 (0)