Skip to content

Commit 7909cff

Browse files
committed
Allow file to use IO.copy_stream.
1 parent 0a44f51 commit 7909cff

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/protocol/http/body/file.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,26 @@
7474
expect(body.read).to be == "ll"
7575
end
7676
end
77+
78+
with "#call" do
79+
let(:output) {StringIO.new}
80+
81+
it "can stream output" do
82+
body.call(output)
83+
84+
expect(output.string).to be == "Hello World"
85+
end
86+
87+
with "/dev/zero" do
88+
it "can stream partial output" do
89+
skip unless File.exist?('/dev/zero')
90+
91+
body = subject.open('/dev/zero', 0...10)
92+
93+
body.call(output)
94+
95+
expect(output.string).to be == "\x00" * 10
96+
end
97+
end
98+
end
7799
end

0 commit comments

Comments
 (0)