Skip to content

Commit d3534c1

Browse files
committed
Add spec
1 parent 98f3a9a commit d3534c1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/openai/client/stream_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@
106106
CHUNK
107107
end
108108
end
109+
110+
context "when called with only 2 arguments (like Faraday 2.1.0)" do
111+
it "handles the call without env parameter" do
112+
expect(user_proc).to receive(:call)
113+
.with(
114+
JSON.parse('{"foo": "bar"}'),
115+
"event.test"
116+
)
117+
118+
# Faraday 2.1.0 calls with only (chunk, size), not (chunk, size, env)
119+
expect do
120+
stream.call(<<~CHUNK, bytes)
121+
event: event.test
122+
data: { "foo": "bar" }
123+
124+
#
125+
CHUNK
126+
end.not_to raise_error
127+
end
128+
end
109129
end
110130
end
111131

0 commit comments

Comments
 (0)