typhoeus 0.6.8 → 0.6.9
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.
- checksums.yaml +15 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +2 -1
- data/README.md +9 -0
- data/lib/typhoeus/easy_factory.rb +2 -2
- data/lib/typhoeus/hydra.rb +1 -1
- data/lib/typhoeus/hydra/queueable.rb +16 -0
- data/lib/typhoeus/hydra/runnable.rb +1 -7
- data/lib/typhoeus/request/stubbable.rb +2 -2
- data/lib/typhoeus/response/informations.rb +4 -0
- data/lib/typhoeus/version.rb +1 -1
- data/spec/rack/typhoeus/middleware/params_decoder/helper_spec.rb +4 -4
- data/spec/rack/typhoeus/middleware/params_decoder_spec.rb +2 -2
- data/spec/typhoeus/adapters/faraday_spec.rb +6 -6
- data/spec/typhoeus/easy_factory_spec.rb +8 -8
- data/spec/typhoeus/expectation_spec.rb +18 -18
- data/spec/typhoeus/hydra/addable_spec.rb +6 -6
- data/spec/typhoeus/hydra/before_spec.rb +9 -9
- data/spec/typhoeus/hydra/cacheable_spec.rb +6 -6
- data/spec/typhoeus/hydra/memoizable_spec.rb +5 -5
- data/spec/typhoeus/hydra/queueable_spec.rb +49 -0
- data/spec/typhoeus/hydra/runnable_spec.rb +11 -30
- data/spec/typhoeus/hydra/stubbable_spec.rb +1 -1
- data/spec/typhoeus/hydra_spec.rb +1 -1
- data/spec/typhoeus/pool_spec.rb +4 -4
- data/spec/typhoeus/request/before_spec.rb +9 -9
- data/spec/typhoeus/request/block_connection_spec.rb +5 -5
- data/spec/typhoeus/request/cacheable_spec.rb +4 -4
- data/spec/typhoeus/request/callbacks_spec.rb +3 -3
- data/spec/typhoeus/request/operations_spec.rb +7 -7
- data/spec/typhoeus/request/stubbable_spec.rb +1 -1
- data/spec/typhoeus/request_spec.rb +3 -3
- data/spec/typhoeus/response/header_spec.rb +2 -2
- data/spec/typhoeus/response/informations_spec.rb +9 -1
- data/spec/typhoeus/response/status_spec.rb +10 -10
- data/spec/typhoeus/response_spec.rb +4 -4
- data/spec/typhoeus_spec.rb +4 -4
- data/typhoeus.gemspec +1 -1
- metadata +7 -14
@@ -19,7 +19,7 @@ describe Typhoeus::Request::Cacheable do
|
|
19
19
|
|
20
20
|
it "doesn't set cached on response" do
|
21
21
|
request.response = response
|
22
|
-
expect(request.response.cached?).to
|
22
|
+
expect(request.response.cached?).to be_falsey
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -27,13 +27,13 @@ describe Typhoeus::Request::Cacheable do
|
|
27
27
|
before { cache.memory[request] = response }
|
28
28
|
|
29
29
|
it "finishes request" do
|
30
|
-
request.
|
30
|
+
expect(request).to receive(:finish).with(response)
|
31
31
|
request.run
|
32
32
|
end
|
33
33
|
|
34
34
|
it "sets cached to true for response" do
|
35
35
|
request.run
|
36
|
-
expect(request.response.cached?).to
|
36
|
+
expect(request.response.cached?).to be_truthy
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -51,7 +51,7 @@ describe Typhoeus::Request::Cacheable do
|
|
51
51
|
before { cache.memory[request] = response }
|
52
52
|
|
53
53
|
it "finishes request" do
|
54
|
-
request.
|
54
|
+
expect(request).to receive(:finish).with(response)
|
55
55
|
request.run
|
56
56
|
end
|
57
57
|
end
|
@@ -18,7 +18,7 @@ describe Typhoeus::Request::Callbacks do
|
|
18
18
|
context "when block given" do
|
19
19
|
it "stores" do
|
20
20
|
request.method(callback).call { p 1 }
|
21
|
-
expect(request.instance_variable_get("@#{callback}")).to
|
21
|
+
expect(request.instance_variable_get("@#{callback}").size).to eq(1)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,7 +26,7 @@ describe Typhoeus::Request::Callbacks do
|
|
26
26
|
it "stores" do
|
27
27
|
request.method(callback).call { p 1 }
|
28
28
|
request.method(callback).call { p 2 }
|
29
|
-
expect(request.instance_variable_get("@#{callback}")).to
|
29
|
+
expect(request.instance_variable_get("@#{callback}").size).to eq(2)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -84,7 +84,7 @@ describe Typhoeus::Request::Callbacks do
|
|
84
84
|
|
85
85
|
context "when local on_complete and gobal on_success" do
|
86
86
|
it "runs all global callbacks first" do
|
87
|
-
|
87
|
+
skip
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -7,19 +7,19 @@ describe Typhoeus::Request::Operations do
|
|
7
7
|
|
8
8
|
describe "#run" do
|
9
9
|
let(:easy) { Ethon::Easy.new }
|
10
|
-
before { Typhoeus::Pool.
|
10
|
+
before { expect(Typhoeus::Pool).to receive(:get).and_return(easy) }
|
11
11
|
|
12
12
|
it "grabs an easy" do
|
13
13
|
request.run
|
14
14
|
end
|
15
15
|
|
16
16
|
it "generates settings" do
|
17
|
-
easy.
|
17
|
+
expect(easy).to receive(:http_request)
|
18
18
|
request.run
|
19
19
|
end
|
20
20
|
|
21
21
|
it "performs" do
|
22
|
-
easy.
|
22
|
+
expect(easy).to receive(:perform)
|
23
23
|
request.run
|
24
24
|
end
|
25
25
|
|
@@ -29,7 +29,7 @@ describe Typhoeus::Request::Operations do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "releases easy" do
|
32
|
-
Typhoeus::Pool.
|
32
|
+
expect(Typhoeus::Pool).to receive(:release)
|
33
33
|
request.run
|
34
34
|
end
|
35
35
|
|
@@ -37,7 +37,7 @@ describe Typhoeus::Request::Operations do
|
|
37
37
|
on_body_called = false
|
38
38
|
request.on_body { |body, response| on_body_called = true }
|
39
39
|
request.run
|
40
|
-
expect(on_body_called).to
|
40
|
+
expect(on_body_called).to be_truthy
|
41
41
|
expect(request.response.body).to satisfy { |v| v.nil? || v == '' }
|
42
42
|
end
|
43
43
|
|
@@ -66,7 +66,7 @@ describe Typhoeus::Request::Operations do
|
|
66
66
|
|
67
67
|
it "calls on_complete" do
|
68
68
|
callback = double(:call)
|
69
|
-
callback.
|
69
|
+
expect(callback).to receive(:call)
|
70
70
|
request.instance_variable_set(:@on_complete, [callback])
|
71
71
|
request.run
|
72
72
|
end
|
@@ -90,7 +90,7 @@ describe Typhoeus::Request::Operations do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it "executes callbacks" do
|
93
|
-
request.
|
93
|
+
expect(request).to receive(:execute_callbacks)
|
94
94
|
request.finish(response)
|
95
95
|
end
|
96
96
|
|
@@ -22,8 +22,8 @@ describe Typhoeus::Request do
|
|
22
22
|
|
23
23
|
it "pushes an easy back into the pool" do
|
24
24
|
easy = double.as_null_object
|
25
|
-
Typhoeus::Pool.
|
26
|
-
Typhoeus::Pool.
|
25
|
+
allow(Typhoeus::Pool).to receive(:get).and_return(easy)
|
26
|
+
expect(Typhoeus::Pool).to receive(:release).with(easy)
|
27
27
|
request.url
|
28
28
|
end
|
29
29
|
end
|
@@ -70,7 +70,7 @@ describe Typhoeus::Request do
|
|
70
70
|
after { Typhoeus.configure { |config| config.verbose = false} }
|
71
71
|
|
72
72
|
it "respects" do
|
73
|
-
expect(request.options[:verbose]).to
|
73
|
+
expect(request.options[:verbose]).to be_truthy
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -63,11 +63,11 @@ describe Typhoeus::Response::Header do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "sets Set-Cookie" do
|
66
|
-
expect(header['set-cookie']).to
|
66
|
+
expect(header['set-cookie'].size).to eq(3)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "provides case insensitive access" do
|
70
|
-
expect(header['Set-CooKie']).to
|
70
|
+
expect(header['Set-CooKie'].size).to eq(3)
|
71
71
|
end
|
72
72
|
|
73
73
|
[
|
@@ -176,6 +176,14 @@ describe Typhoeus::Response::Informations do
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
+
describe "#request_size" do
|
180
|
+
let(:options) { { :request_size => 2 } }
|
181
|
+
|
182
|
+
it "returns request_size from options" do
|
183
|
+
expect(response.request_size).to eq(2)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
179
187
|
describe "#headers" do
|
180
188
|
context "when no response_headers" do
|
181
189
|
it "returns nil" do
|
@@ -249,7 +257,7 @@ describe Typhoeus::Response::Informations do
|
|
249
257
|
let(:options) { {:response_headers => "Server: A\r\n\r\nServer: B"} }
|
250
258
|
|
251
259
|
it "returns response from all but last headers" do
|
252
|
-
expect(response.redirections).to
|
260
|
+
expect(response.redirections.size).to eq(1)
|
253
261
|
end
|
254
262
|
end
|
255
263
|
end
|
@@ -101,7 +101,7 @@ describe Typhoeus::Response::Status do
|
|
101
101
|
let(:return_code) { :ok }
|
102
102
|
|
103
103
|
it "returns true" do
|
104
|
-
expect(response.success?).to
|
104
|
+
expect(response.success?).to be_truthy
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -109,7 +109,7 @@ describe Typhoeus::Response::Status do
|
|
109
109
|
let(:return_code) { nil }
|
110
110
|
|
111
111
|
it "returns true" do
|
112
|
-
expect(response.success?).to
|
112
|
+
expect(response.success?).to be_truthy
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
@@ -121,7 +121,7 @@ describe Typhoeus::Response::Status do
|
|
121
121
|
let(:return_code) { :ok }
|
122
122
|
|
123
123
|
it "returns true" do
|
124
|
-
expect(response.success?).to
|
124
|
+
expect(response.success?).to be_truthy
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
@@ -129,7 +129,7 @@ describe Typhoeus::Response::Status do
|
|
129
129
|
let(:return_code) { nil }
|
130
130
|
|
131
131
|
it "returns false" do
|
132
|
-
expect(response.success?).to
|
132
|
+
expect(response.success?).to be_falsey
|
133
133
|
end
|
134
134
|
end
|
135
135
|
end
|
@@ -139,7 +139,7 @@ describe Typhoeus::Response::Status do
|
|
139
139
|
let(:options) { {:return_code => :ok, :response_code => 500} }
|
140
140
|
|
141
141
|
it "returns false" do
|
142
|
-
expect(response.success?).to
|
142
|
+
expect(response.success?).to be_falsey
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
@@ -155,7 +155,7 @@ describe Typhoeus::Response::Status do
|
|
155
155
|
let(:return_code) { :ok }
|
156
156
|
|
157
157
|
it "returns false" do
|
158
|
-
expect(response.modified?).to
|
158
|
+
expect(response.modified?).to be_falsey
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
@@ -163,7 +163,7 @@ describe Typhoeus::Response::Status do
|
|
163
163
|
let(:return_code) { nil }
|
164
164
|
|
165
165
|
it "returns false" do
|
166
|
-
expect(response.modified?).to
|
166
|
+
expect(response.modified?).to be_falsey
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
@@ -175,7 +175,7 @@ describe Typhoeus::Response::Status do
|
|
175
175
|
let(:return_code) { :ok }
|
176
176
|
|
177
177
|
it "returns false" do
|
178
|
-
expect(response.modified?).to
|
178
|
+
expect(response.modified?).to be_falsey
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
@@ -183,7 +183,7 @@ describe Typhoeus::Response::Status do
|
|
183
183
|
let(:return_code) { nil }
|
184
184
|
|
185
185
|
it "returns true" do
|
186
|
-
expect(response.modified?).to
|
186
|
+
expect(response.modified?).to be_falsey
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
@@ -193,7 +193,7 @@ describe Typhoeus::Response::Status do
|
|
193
193
|
let(:options) { {:return_code => :ok, :response_code => 500} }
|
194
194
|
|
195
195
|
it "returns true" do
|
196
|
-
expect(response.modified?).to
|
196
|
+
expect(response.modified?).to be_truthy
|
197
197
|
end
|
198
198
|
end
|
199
199
|
end
|
@@ -37,7 +37,7 @@ describe Typhoeus::Response do
|
|
37
37
|
before { response.mock = true }
|
38
38
|
|
39
39
|
it "returns @mock" do
|
40
|
-
expect(response.mock).to
|
40
|
+
expect(response.mock).to be_truthy
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -45,7 +45,7 @@ describe Typhoeus::Response do
|
|
45
45
|
let(:options) { {:mock => true} }
|
46
46
|
|
47
47
|
it "returns options[:mock]" do
|
48
|
-
expect(response.mock).to
|
48
|
+
expect(response.mock).to be_truthy
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -84,7 +84,7 @@ describe Typhoeus::Response do
|
|
84
84
|
before { response.cached = true }
|
85
85
|
|
86
86
|
it "returns cached status" do
|
87
|
-
expect(response.cached?).to
|
87
|
+
expect(response.cached?).to be_truthy
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -92,7 +92,7 @@ describe Typhoeus::Response do
|
|
92
92
|
before { response.cached = nil }
|
93
93
|
|
94
94
|
it "returns false" do
|
95
|
-
expect(response.cached?).to
|
95
|
+
expect(response.cached?).to be_falsey
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
data/spec/typhoeus_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe Typhoeus do
|
|
14
14
|
|
15
15
|
it "sets values config" do
|
16
16
|
Typhoeus::Config.verbose = true
|
17
|
-
expect(Typhoeus::Config.verbose).to
|
17
|
+
expect(Typhoeus::Config.verbose).to be_truthy
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -43,7 +43,7 @@ describe Typhoeus do
|
|
43
43
|
|
44
44
|
it "adds expectation" do
|
45
45
|
Typhoeus.stub(:get, "")
|
46
|
-
expect(Typhoeus::Expectation.all).to
|
46
|
+
expect(Typhoeus::Expectation.all.size).to eq(1)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -59,7 +59,7 @@ describe Typhoeus do
|
|
59
59
|
|
60
60
|
it "doesn't add expectation" do
|
61
61
|
Typhoeus.stub(base_url)
|
62
|
-
expect(Typhoeus::Expectation.all).to
|
62
|
+
expect(Typhoeus::Expectation.all.size).to eq(1)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -67,7 +67,7 @@ describe Typhoeus do
|
|
67
67
|
describe ".before" do
|
68
68
|
it "adds callback" do
|
69
69
|
Typhoeus.before { true }
|
70
|
-
expect(Typhoeus.before).to
|
70
|
+
expect(Typhoeus.before.size).to eq(1)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
data/typhoeus.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.required_rubygems_version = ">= 1.3.6"
|
18
18
|
s.license = 'MIT'
|
19
19
|
|
20
|
-
s.add_dependency('ethon', [">= 0.7.
|
20
|
+
s.add_dependency('ethon', [">= 0.7.1"])
|
21
21
|
|
22
22
|
s.files = `git ls-files`.split("\n")
|
23
23
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typhoeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David Balatero
|
@@ -11,24 +10,22 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2014-
|
13
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: ethon
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ! '>='
|
22
20
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.7.
|
21
|
+
version: 0.7.1
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ! '>='
|
30
27
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0.7.
|
28
|
+
version: 0.7.1
|
32
29
|
description: Like a modern code version of the mythical beast with 100 serpent heads,
|
33
30
|
Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling logic.
|
34
31
|
email:
|
@@ -131,30 +128,26 @@ files:
|
|
131
128
|
homepage: https://github.com/typhoeus/typhoeus
|
132
129
|
licenses:
|
133
130
|
- MIT
|
131
|
+
metadata: {}
|
134
132
|
post_install_message:
|
135
133
|
rdoc_options: []
|
136
134
|
require_paths:
|
137
135
|
- lib
|
138
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
137
|
requirements:
|
141
138
|
- - ! '>='
|
142
139
|
- !ruby/object:Gem::Version
|
143
140
|
version: '0'
|
144
|
-
segments:
|
145
|
-
- 0
|
146
|
-
hash: 1782230934011170024
|
147
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
142
|
requirements:
|
150
143
|
- - ! '>='
|
151
144
|
- !ruby/object:Gem::Version
|
152
145
|
version: 1.3.6
|
153
146
|
requirements: []
|
154
147
|
rubyforge_project:
|
155
|
-
rubygems_version:
|
148
|
+
rubygems_version: 2.2.2
|
156
149
|
signing_key:
|
157
|
-
specification_version:
|
150
|
+
specification_version: 4
|
158
151
|
summary: Parallel HTTP library on top of libcurl multi.
|
159
152
|
test_files:
|
160
153
|
- spec/rack/typhoeus/middleware/params_decoder/helper_spec.rb
|