rack-client 0.3.1.pre.c → 0.3.1.pre.d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rack/client/adapter/base.rb +0 -1
- data/lib/rack/client/adapter/simple.rb +13 -4
- data/lib/rack/client/version.rb +1 -1
- metadata +80 -108
- data/spec/core/headers_spec.rb +0 -47
- data/spec/core/headers_spec.rbc +0 -1674
- data/spec/core/response_spec.rb +0 -78
- data/spec/core/response_spec.rbc +0 -2244
- data/spec/handler/em_http_spec.rb +0 -7
- data/spec/handler/em_http_spec.rbc +0 -224
- data/spec/handler/excon_spec.rb +0 -7
- data/spec/handler/excon_spec.rbc +0 -224
- data/spec/handler/net_http_spec.rb +0 -11
- data/spec/handler/net_http_spec.rbc +0 -307
- data/spec/handler/typhoeus_spec.rb +0 -11
- data/spec/handler/typhoeus_spec.rbc +0 -307
- data/spec/helpers/async_helper.rb +0 -31
- data/spec/helpers/async_helper.rbc +0 -843
- data/spec/helpers/em_http_helper.rb +0 -24
- data/spec/helpers/em_http_helper.rbc +0 -663
- data/spec/helpers/excon_helper.rb +0 -13
- data/spec/helpers/excon_helper.rbc +0 -461
- data/spec/helpers/handler_helper.rb +0 -68
- data/spec/helpers/handler_helper.rbc +0 -1769
- data/spec/helpers/net_http_helper.rb +0 -26
- data/spec/helpers/net_http_helper.rbc +0 -806
- data/spec/helpers/sync_helper.rb +0 -9
- data/spec/helpers/sync_helper.rbc +0 -311
- data/spec/helpers/typhoeus_helper.rb +0 -32
- data/spec/helpers/typhoeus_helper.rbc +0 -936
- data/spec/middleware/cache_spec.rb +0 -25
- data/spec/middleware/cache_spec.rbc +0 -712
- data/spec/middleware/cookie_jar_spec.rb +0 -19
- data/spec/middleware/cookie_jar_spec.rbc +0 -614
- data/spec/middleware/etag_spec.rb +0 -10
- data/spec/middleware/etag_spec.rbc +0 -438
- data/spec/middleware/follow_redirects_spec.rb +0 -12
- data/spec/middleware/follow_redirects_spec.rbc +0 -402
- data/spec/middleware/lint_spec.rb +0 -10
- data/spec/middleware/lint_spec.rbc +0 -392
- data/spec/shared/handler_api.rb +0 -33
- data/spec/shared/handler_api.rbc +0 -1340
- data/spec/shared/streamed_response_api.rb +0 -14
- data/spec/shared/streamed_response_api.rbc +0 -508
- data/spec/spec_apps/cache.ru +0 -14
- data/spec/spec_apps/cookie.ru +0 -12
- data/spec/spec_apps/delete.ru +0 -10
- data/spec/spec_apps/get.ru +0 -13
- data/spec/spec_apps/head.ru +0 -10
- data/spec/spec_apps/hello_world.ru +0 -1
- data/spec/spec_apps/redirect.ru +0 -13
- data/spec/spec_apps/stream.ru +0 -9
- data/spec/spec_config.ru +0 -10
- data/spec/spec_helper.rb +0 -22
data/spec/core/response_spec.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Rack::Client::Response do
|
4
|
-
context "#initialize" do
|
5
|
-
it 'follows the rack tuple convention for parameters' do
|
6
|
-
response = Rack::Client::Response.new(200, {'X-Foo' => 'Bar'}, ['Hello World!'])
|
7
|
-
|
8
|
-
response.status.should == 200
|
9
|
-
response.headers['X-Foo'].should == 'Bar'
|
10
|
-
response.body.should == ['Hello World!']
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'accepts a callback for streamed responses' do
|
14
|
-
body = %w[ This is a streamed response ]
|
15
|
-
check = body.dup
|
16
|
-
|
17
|
-
response = Rack::Client::Response.new(200) {|block| body.each(&block) }
|
18
|
-
|
19
|
-
response.each do |part|
|
20
|
-
part.should == check.shift
|
21
|
-
end
|
22
|
-
|
23
|
-
check.should be_empty
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "#each" do
|
28
|
-
it 'will not loose the streamed body chunks' do
|
29
|
-
body = %w[ This is also a streamed response ]
|
30
|
-
check = body.dup
|
31
|
-
|
32
|
-
response = Rack::Client::Response.new(200) {|block| body.each(&block) }
|
33
|
-
|
34
|
-
response.each {|chunk| }
|
35
|
-
|
36
|
-
response.instance_variable_get(:@body).should == check
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'will yield the existing body before the streamed body' do
|
40
|
-
existing, streamed = %w[ This is mostly ], %w[ a streamed response ]
|
41
|
-
check = existing + streamed
|
42
|
-
|
43
|
-
response = Rack::Client::Response.new(200, {}, existing) {|block| streamed.each(&block) }
|
44
|
-
|
45
|
-
response.each do |part|
|
46
|
-
part.should == check.shift
|
47
|
-
end
|
48
|
-
|
49
|
-
check.should be_empty
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'is idempotent' do
|
53
|
-
body = %w[ This should only appear once ]
|
54
|
-
check = body.dup
|
55
|
-
|
56
|
-
response = Rack::Client::Response.new(200) {|block| body.each(&block) }
|
57
|
-
|
58
|
-
response.each {|chunk| }
|
59
|
-
|
60
|
-
response.instance_variable_get(:@body).should == check
|
61
|
-
|
62
|
-
response.each {|chunk| }
|
63
|
-
|
64
|
-
response.instance_variable_get(:@body).should == check
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context '#body' do
|
69
|
-
it 'will include the body stream' do
|
70
|
-
body = %w[ This is sorta streamed ]
|
71
|
-
check = body.dup
|
72
|
-
|
73
|
-
response = Rack::Client::Response.new(200) {|block| body.each(&block) }
|
74
|
-
|
75
|
-
response.body.should == check
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|