|
113 | 113 | Adyen::Client.new(env: :test, connection_options: connection_options)
|
114 | 114 | end
|
115 | 115 |
|
| 116 | + # test with Ruby 3.2+ only (where Faraday requestOptions timeout is supported) |
116 | 117 | it 'initiates a Faraday connection with the provided options' do
|
117 |
| - connection_options = Faraday::ConnectionOptions.new |
| 118 | + skip "Only runs on Ruby >= 3.2" unless RUBY_VERSION >= '3.2' |
| 119 | + connection_options = Faraday::ConnectionOptions.new( |
| 120 | + request: { |
| 121 | + open_timeout: 5, |
| 122 | + timeout: 10 |
| 123 | + } |
| 124 | + ) |
118 | 125 | expect(Faraday::ConnectionOptions).not_to receive(:new)
|
119 | 126 | client = Adyen::Client.new(api_key: 'api_key', env: :mock, connection_options: connection_options)
|
| 127 | + # verify custom options |
| 128 | + expect(client.connection_options[:request][:open_timeout]).to eq(5) |
| 129 | + expect(client.connection_options[:request][:timeout]).to eq(10) |
120 | 130 |
|
121 | 131 | mock_faraday_connection = double(Faraday::Connection)
|
122 | 132 | client.service_url(@shared_values[:service], 'payments/details', client.checkout.version)
|
|
130 | 140 | client.checkout.payments_api.payments_details(request_body)
|
131 | 141 | end
|
132 | 142 |
|
| 143 | + # test with Ruby 3.2+ only (where Faraday requestOptions timeout is supported) |
| 144 | + it 'initiates a Faraday connection with the expected default timeouts' do |
| 145 | + skip "Only runs on Ruby >= 3.2" unless RUBY_VERSION >= '3.2' |
| 146 | + client = Adyen::Client.new(env: :test) |
| 147 | + expect(client.connection_options[:request][:open_timeout]).to eq(30) |
| 148 | + expect(client.connection_options[:request][:timeout]).to eq(60) |
| 149 | + end |
| 150 | + |
133 | 151 | it "checks the creation of checkout url" do
|
134 | 152 | client = Adyen::Client.new(api_key: "api_key", env: :test)
|
135 | 153 | expect(client.service_url("Checkout", "paymentMethods", "71")).
|
|
0 commit comments