Skip to content

Commit fb13b4b

Browse files
committed
added testing
1 parent 008f95f commit fb13b4b

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

spec/client_spec.rb

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,18 @@
285285
.to eq('https://ca-test.adyen.com/ca/services/DisputesService')
286286
end
287287

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 }
297292
)
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)
300295

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
303300
end
304301
end
305302
end

0 commit comments

Comments
 (0)