Skip to content

Commit

Permalink
Allow file to use IO.copy_stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Sep 5, 2024
1 parent 0a44f51 commit 7909cff
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/protocol/http/body/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,26 @@
expect(body.read).to be == "ll"
end
end

with "#call" do
let(:output) {StringIO.new}

it "can stream output" do
body.call(output)

expect(output.string).to be == "Hello World"
end

with "/dev/zero" do
it "can stream partial output" do
skip unless File.exist?('/dev/zero')

body = subject.open('/dev/zero', 0...10)

body.call(output)

expect(output.string).to be == "\x00" * 10
end
end
end
end

0 comments on commit 7909cff

Please sign in to comment.