forked from excon/excon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline_tests.rb
40 lines (34 loc) · 1.28 KB
/
pipeline_tests.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Shindo.tests('Pipelined Requests') do
with_server('good_ipv4') do
tests('with default :persistent => true') do
returns(%w{ 1 2 3 4 }, 'connection is persistent') do
connection = Excon.new('http://127.0.0.1:9292', :persistent => true)
ret = []
ret << connection.requests([
{:method => :get, :path => '/echo/request_count'},
{:method => :get, :path => '/echo/request_count'}
]).map(&:body)
ret << connection.requests([
{:method => :get, :path => '/echo/request_count'},
{:method => :get, :path => '/echo/request_count'}
]).map(&:body)
ret.flatten
end
end
tests('with default :persistent => false') do
returns(%w{ 1 2 1 2 }, 'connection is persistent per call to #requests') do
connection = Excon.new('http://127.0.0.1:9292', :persistent => false)
ret = []
ret << connection.requests([
{:method => :get, :path => '/echo/request_count'},
{:method => :get, :path => '/echo/request_count'}
]).map(&:body)
ret << connection.requests([
{:method => :get, :path => '/echo/request_count'},
{:method => :get, :path => '/echo/request_count'}
]).map(&:body)
ret.flatten
end
end
end
end