|
102 | 102 | it "sets ssl version" do
|
103 | 103 | expect(subject.ssl_version).to eq(:TLSv1)
|
104 | 104 | end
|
105 |
| - end if RUBY_VERSION > '1.9' |
| 105 | + end |
106 | 106 | end
|
107 | 107 |
|
108 | 108 | context "when dealing with IPv6" do
|
|
119 | 119 | it "should set the ciphers on the connection" do
|
120 | 120 | expect(subject.ciphers).to eq('RC4-SHA')
|
121 | 121 | end
|
122 |
| - end if RUBY_VERSION > '1.9' |
| 122 | + end |
123 | 123 |
|
124 | 124 | context "when timeout is not set" do
|
125 | 125 | it "doesn't set the timeout" do
|
|
152 | 152 | it { is_expected.to eq(5) }
|
153 | 153 | end
|
154 | 154 |
|
155 |
| - if RUBY_VERSION >= '2.6.0' |
156 |
| - describe '#write_timeout' do |
157 |
| - subject { super().write_timeout } |
158 |
| - it { is_expected.to eq(5) } |
159 |
| - end |
| 155 | + describe '#write_timeout' do |
| 156 | + subject { super().write_timeout } |
| 157 | + it { is_expected.to eq(5) } |
160 | 158 | end
|
161 | 159 | end
|
162 | 160 |
|
|
223 | 221 | it { is_expected.to eq(5) }
|
224 | 222 | end
|
225 | 223 |
|
226 |
| - if RUBY_VERSION >= '2.6.0' |
227 |
| - describe '#write_timeout' do |
228 |
| - subject { super().write_timeout } |
229 |
| - it { is_expected.to eq(5) } |
230 |
| - end |
| 224 | + describe '#write_timeout' do |
| 225 | + subject { super().write_timeout } |
| 226 | + it { is_expected.to eq(5) } |
231 | 227 | end
|
232 | 228 |
|
233 | 229 | describe '#read_timeout' do
|
|
247 | 243 | )
|
248 | 244 | expect(http).to receive(:open_timeout=)
|
249 | 245 | expect(http).to receive(:read_timeout=).twice
|
250 |
| - if RUBY_VERSION >= '2.6.0' |
251 |
| - expect(http).to receive(:write_timeout=) |
252 |
| - end |
| 246 | + expect(http).to receive(:write_timeout=) |
253 | 247 | allow(Net::HTTP).to receive_messages(new: http)
|
254 | 248 | adapter.connection
|
255 | 249 | end
|
|
298 | 292 | it { is_expected.to eq(7) }
|
299 | 293 | end
|
300 | 294 |
|
301 |
| - if RUBY_VERSION >= '2.6.0' |
302 |
| - describe '#write_timeout' do |
303 |
| - subject { super().write_timeout } |
304 |
| - it { is_expected.to eq(5) } |
305 |
| - end |
| 295 | + describe '#write_timeout' do |
| 296 | + subject { super().write_timeout } |
| 297 | + it { is_expected.to eq(5) } |
306 | 298 | end
|
307 | 299 |
|
308 | 300 | describe '#read_timeout' do
|
|
322 | 314 | )
|
323 | 315 | expect(http).to receive(:open_timeout=).twice
|
324 | 316 | expect(http).to receive(:read_timeout=)
|
325 |
| - if RUBY_VERSION >= '2.6.0' |
326 |
| - expect(http).to receive(:write_timeout=) |
327 |
| - end |
| 317 | + expect(http).to receive(:write_timeout=) |
328 | 318 | allow(Net::HTTP).to receive_messages(new: http)
|
329 | 319 | adapter.connection
|
330 | 320 | end
|
331 | 321 | end
|
332 | 322 |
|
333 |
| - if RUBY_VERSION >= '2.6.0' |
334 |
| - context "when timeout is not set and write_timeout is set to 8 seconds" do |
335 |
| - let(:options) { {write_timeout: 8} } |
| 323 | + context "when timeout is not set and write_timeout is set to 8 seconds" do |
| 324 | + let(:options) { {write_timeout: 8} } |
336 | 325 |
|
337 |
| - describe '#write_timeout' do |
338 |
| - subject { super().write_timeout } |
339 |
| - it { is_expected.to eq(8) } |
340 |
| - end |
| 326 | + describe '#write_timeout' do |
| 327 | + subject { super().write_timeout } |
| 328 | + it { is_expected.to eq(8) } |
| 329 | + end |
341 | 330 |
|
342 |
| - it "should not set the open timeout" do |
343 |
| - http = double( |
344 |
| - "http", |
345 |
| - :null_object => true, |
346 |
| - :use_ssl= => false, |
347 |
| - :use_ssl? => false, |
348 |
| - :read_timeout= => 0, |
349 |
| - :open_timeout= => 0, |
350 |
| - :write_timeout= => 0, |
| 331 | + it "should not set the open timeout" do |
| 332 | + http = double( |
| 333 | + "http", |
| 334 | + :null_object => true, |
| 335 | + :use_ssl= => false, |
| 336 | + :use_ssl? => false, |
| 337 | + :read_timeout= => 0, |
| 338 | + :open_timeout= => 0, |
| 339 | + :write_timeout= => 0, |
351 | 340 |
|
352 |
| - ) |
353 |
| - expect(http).not_to receive(:open_timeout=) |
354 |
| - allow(Net::HTTP).to receive_messages(new: http) |
355 |
| - adapter.connection |
356 |
| - end |
| 341 | + ) |
| 342 | + expect(http).not_to receive(:open_timeout=) |
| 343 | + allow(Net::HTTP).to receive_messages(new: http) |
| 344 | + adapter.connection |
| 345 | + end |
357 | 346 |
|
358 |
| - it "should not set the read timeout" do |
359 |
| - http = double( |
360 |
| - "http", |
361 |
| - :null_object => true, |
362 |
| - :use_ssl= => false, |
363 |
| - :use_ssl? => false, |
364 |
| - :read_timeout= => 0, |
365 |
| - :open_timeout= => 0, |
366 |
| - :write_timeout= => 0, |
| 347 | + it "should not set the read timeout" do |
| 348 | + http = double( |
| 349 | + "http", |
| 350 | + :null_object => true, |
| 351 | + :use_ssl= => false, |
| 352 | + :use_ssl? => false, |
| 353 | + :read_timeout= => 0, |
| 354 | + :open_timeout= => 0, |
| 355 | + :write_timeout= => 0, |
367 | 356 |
|
368 |
| - ) |
369 |
| - expect(http).not_to receive(:read_timeout=) |
370 |
| - allow(Net::HTTP).to receive_messages(new: http) |
371 |
| - adapter.connection |
372 |
| - end |
| 357 | + ) |
| 358 | + expect(http).not_to receive(:read_timeout=) |
| 359 | + allow(Net::HTTP).to receive_messages(new: http) |
| 360 | + adapter.connection |
373 | 361 | end
|
374 | 362 |
|
375 | 363 | context "when timeout is set and write_timeout is set to 8 seconds" do
|
|
415 | 403 | end
|
416 | 404 |
|
417 | 405 | context "when setting max_retries" do
|
418 |
| - if RUBY_VERSION >= '2.5.0' |
419 |
| - context "to 5 times" do |
420 |
| - let(:options) { {max_retries: 5} } |
421 |
| - describe '#max_retries' do |
422 |
| - subject { super().max_retries } |
423 |
| - it { is_expected.to eq(5) } |
424 |
| - end |
| 406 | + context "to 5 times" do |
| 407 | + let(:options) { {max_retries: 5} } |
| 408 | + describe '#max_retries' do |
| 409 | + subject { super().max_retries } |
| 410 | + it { is_expected.to eq(5) } |
425 | 411 | end
|
| 412 | + end |
426 | 413 |
|
427 |
| - context "to 0 times" do |
428 |
| - let(:options) { {max_retries: 0} } |
429 |
| - describe '#max_retries' do |
430 |
| - subject { super().max_retries } |
431 |
| - it { is_expected.to eq(0) } |
432 |
| - end |
| 414 | + context "to 0 times" do |
| 415 | + let(:options) { {max_retries: 0} } |
| 416 | + describe '#max_retries' do |
| 417 | + subject { super().max_retries } |
| 418 | + it { is_expected.to eq(0) } |
433 | 419 | end
|
434 | 420 | end
|
435 | 421 |
|
|
545 | 531 | subject { super().local_port }
|
546 | 532 | it { is_expected.to eq(12345) }
|
547 | 533 | end
|
548 |
| - end if RUBY_VERSION >= '2.0' |
| 534 | + end |
549 | 535 |
|
550 | 536 | context "when providing PEM certificates" do
|
551 | 537 | let(:pem) { :pem_contents }
|
|
0 commit comments