Skip to content

Commit bf29da4

Browse files
committed
Remove HTTP error case from http spec
1 parent 8db1639 commit bf29da4

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

spec/openai/client/http_spec.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -153,31 +153,6 @@
153153
end
154154
end
155155

156-
context "when OpenAI returns an HTTP error" do
157-
let(:chunk) { "{\"error\":{\"message\":\"A bad thing has happened!\"}}" }
158-
let(:env) do
159-
Faraday::Env.new(
160-
status: 500,
161-
url: URI::HTTPS.build(host: "api.openai.com"),
162-
request: Faraday::RequestOptions.new
163-
)
164-
end
165-
166-
it "does not raise an error and calls the user proc with the error parsed as JSON" do
167-
expect(user_proc).to receive(:call).with(
168-
{
169-
"error" => {
170-
"message" => "A bad thing has happened!"
171-
}
172-
}
173-
)
174-
175-
expect do
176-
stream.call(chunk, 0, env)
177-
end.not_to raise_error
178-
end
179-
end
180-
181156
context "when called with JSON split across chunks" do
182157
it "calls the user proc with the data parsed as JSON" do
183158
expect(user_proc).to receive(:call).with(JSON.parse('{ "foo": "bar" }'))

0 commit comments

Comments
 (0)