|
1 | 1 | RSpec.describe OpenAI::Client do
|
| 2 | + let(:default_timeout) { OpenAI::Configuration::DEFAULT_REQUEST_TIMEOUT } |
| 3 | + |
2 | 4 | it "can be initialized" do
|
3 | 5 | expect { OpenAI::Client.new }.not_to raise_error
|
4 | 6 | end
|
5 | 7 |
|
6 | 8 | describe ".get" do
|
7 | 9 | it "passes timeout as param to httparty" do
|
8 |
| - expect(HTTParty).to receive(:get).with(any_args, hash_including(timeout: 60)) |
| 10 | + expect(HTTParty).to receive(:get).with(any_args, hash_including(timeout: default_timeout)) |
9 | 11 | OpenAI::Client.get(path: "abc")
|
10 | 12 | end
|
11 | 13 | end
|
12 | 14 |
|
13 | 15 | describe ".json_post" do
|
14 | 16 | it "passes timeout as param to httparty" do
|
15 |
| - expect(HTTParty).to receive(:post).with(any_args, hash_including(timeout: 60)) |
| 17 | + expect(HTTParty).to receive(:post).with(any_args, hash_including(timeout: default_timeout)) |
16 | 18 | OpenAI::Client.json_post(path: "abc", parameters: { foo: :bar })
|
17 | 19 | end
|
18 | 20 | end
|
19 | 21 |
|
20 | 22 | describe ".multipart_post" do
|
21 | 23 | it "passes timeout as param to httparty" do
|
22 |
| - expect(HTTParty).to receive(:post).with(any_args, hash_including(timeout: 60)) |
| 24 | + expect(HTTParty).to receive(:post).with(any_args, hash_including(timeout: default_timeout)) |
23 | 25 | OpenAI::Client.multipart_post(path: "abc")
|
24 | 26 | end
|
25 | 27 | end
|
26 | 28 |
|
27 | 29 | describe ".delete" do
|
28 | 30 | it "passes timeout as param to httparty" do
|
29 |
| - expect(HTTParty).to receive(:delete).with(any_args, hash_including(timeout: 60)) |
| 31 | + expect(HTTParty).to receive(:delete).with(any_args, hash_including(timeout: default_timeout)) |
30 | 32 | OpenAI::Client.delete(path: "abc")
|
31 | 33 | end
|
32 | 34 | end
|
|
0 commit comments