|
285 | 285 | .to eq('https://ca-test.adyen.com/ca/services/DisputesService')
|
286 | 286 | end
|
287 | 287 |
|
288 |
| - context 'connection options handling' do |
289 |
| - it 'builds a new set of ConnectionOptions when none are provided' do |
290 |
| - expect(Faraday::ConnectionOptions).to receive(:new).and_call_original |
291 |
| - Adyen::Client.new(env: :test) |
292 |
| - end |
293 |
| - |
294 |
| - it 'uses the supplied ConnectionOptions when provided' do |
295 |
| - custom_options = Faraday::ConnectionOptions.new( |
296 |
| - request: { open_timeout: 7, timeout: 17, read_timeout: 27, write_timeout: 37 } |
| 288 | + context 'custom timeouts' do |
| 289 | + it 'applies custom open/response/read/write timeouts' do |
| 290 | + custom_opts = Faraday::ConnectionOptions.new( |
| 291 | + request: { open_timeout: 2, timeout: 4, read_timeout: 6, write_timeout: 8 } |
297 | 292 | )
|
298 |
| - expect(Faraday::ConnectionOptions).not_to receive(:new) |
299 |
| - client = Adyen::Client.new(env: :test, connection_options: custom_options) |
| 293 | + client = Adyen::Client.new(env: :test, connection_options: custom_opts) |
| 294 | + opts = client.instance_variable_get(:@connection_options) |
300 | 295 |
|
301 |
| - options = client.instance_variable_get(:@connection_options) |
302 |
| - expect(options).to be(custom_options) |
| 296 | + expect(opts[:request][:open_timeout]).to eq 2 |
| 297 | + expect(opts[:request][:timeout]).to eq 4 |
| 298 | + expect(opts[:request][:read_timeout]).to eq 6 |
| 299 | + expect(opts[:request][:write_timeout]).to eq 8 |
303 | 300 | end
|
304 | 301 | end
|
305 | 302 | end
|
0 commit comments