Skip to content

Commit

Permalink
Fix multi_writer specs to close file before reading/deleting it. (#8674)
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin authored and RX14 committed Jan 13, 2020
1 parent f6d84eb commit 26cd639
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions spec/std/io/multi_writer_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ describe "IO::MultiWriter" do
describe "#flush" do
it "writes to IO and File" do
with_tempfile("multiple_writer_spec") do |path|
file = File.new(path, "w")
io = IO::Memory.new

writer = IO::MultiWriter.new(io, file)
File.open(path, "w") do |file|
writer = IO::MultiWriter.new(io, file)

writer.puts "foo bar"
writer.flush
writer.puts "foo bar"
writer.flush
end

io.to_s.should eq("foo bar\n")
File.read(path).should eq("foo bar\n")
Expand Down

0 comments on commit 26cd639

Please sign in to comment.