http 0.8.14 → 0.9.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +3 -7
- data/Gemfile +3 -6
- data/README.md +12 -22
- data/lib/http/chainable.rb +0 -8
- data/lib/http/client.rb +9 -11
- data/lib/http/errors.rb +0 -3
- data/lib/http/options.rb +12 -27
- data/lib/http/request.rb +2 -21
- data/lib/http/response.rb +0 -6
- data/lib/http/timeout/null.rb +24 -1
- data/lib/http/timeout/per_operation.rb +8 -24
- data/lib/http/uri.rb +2 -7
- data/lib/http/version.rb +1 -1
- data/spec/lib/http/client_spec.rb +1 -31
- data/spec/lib/http/options/merge_spec.rb +0 -1
- data/spec/lib/http/request_spec.rb +2 -7
- data/spec/lib/http/response_spec.rb +0 -5
- data/spec/lib/http_spec.rb +0 -8
- data/spec/spec_helper.rb +5 -0
- data/spec/support/connection_reuse_shared.rb +2 -0
- data/spec/support/http_handling_shared.rb +7 -0
- metadata +36 -19
- data/lib/http/cache.rb +0 -146
- data/lib/http/cache/headers.rb +0 -100
- data/lib/http/cache/null_cache.rb +0 -13
- data/lib/http/request/caching.rb +0 -95
- data/lib/http/response/caching.rb +0 -143
- data/lib/http/response/io_body.rb +0 -63
- data/lib/http/response/string_body.rb +0 -53
- data/spec/lib/http/cache/headers_spec.rb +0 -77
- data/spec/lib/http/cache_spec.rb +0 -182
- data/spec/lib/http/request/caching_spec.rb +0 -133
- data/spec/lib/http/response/caching_spec.rb +0 -201
- data/spec/lib/http/response/io_body_spec.rb +0 -35
- data/spec/lib/http/response/string_body_spec.rb +0 -35
@@ -1,35 +0,0 @@
|
|
1
|
-
RSpec.describe HTTP::Response::IoBody do
|
2
|
-
subject(:body) { described_class.new StringIO.new("Hello, World!") }
|
3
|
-
|
4
|
-
it "has the content" do
|
5
|
-
expect(subject.to_s).to eq "Hello, World!"
|
6
|
-
end
|
7
|
-
|
8
|
-
context "when body empty" do
|
9
|
-
subject(:body) { described_class.new StringIO.new("") }
|
10
|
-
|
11
|
-
it "returns responds to empty? with true" do
|
12
|
-
expect(subject).to be_empty
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#readpartial" do
|
17
|
-
context "with size given" do
|
18
|
-
it "returns only that amount" do
|
19
|
-
expect(body.readpartial(4)).to eq "Hell"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "without size given" do
|
24
|
-
it "returns parts of the content" do
|
25
|
-
expect(body.readpartial).to eq "Hello, World!"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "yields successive parts of the content" do
|
32
|
-
expect { |b| body.each(&b) }.to yield_with_args "Hello, World!"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
RSpec.describe HTTP::Response::StringBody do
|
2
|
-
subject(:body) { described_class.new "Hello, World!" }
|
3
|
-
|
4
|
-
it "has the content" do
|
5
|
-
expect(subject.to_s).to eq "Hello, World!"
|
6
|
-
end
|
7
|
-
|
8
|
-
context "when body empty" do
|
9
|
-
subject(:body) { described_class.new "" }
|
10
|
-
|
11
|
-
it "returns responds to empty? with true" do
|
12
|
-
expect(subject).to be_empty
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#readpartial" do
|
17
|
-
context "with size given" do
|
18
|
-
it "returns only that amount" do
|
19
|
-
expect(body.readpartial(4)).to eq "Hell"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "without size given" do
|
24
|
-
it "returns parts of the full content" do
|
25
|
-
expect(body.readpartial).to eq "Hello, World!"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "yields contents" do
|
32
|
-
expect { |b| body.each(&b) }.to yield_with_args "Hello, World!"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|