http 2.2.2 → 3.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +46 -13
  3. data/.travis.yml +17 -12
  4. data/CHANGES.md +25 -1
  5. data/Gemfile +11 -4
  6. data/Guardfile +2 -0
  7. data/README.md +4 -5
  8. data/Rakefile +14 -13
  9. data/http.gemspec +3 -1
  10. data/lib/http.rb +1 -0
  11. data/lib/http/chainable.rb +15 -14
  12. data/lib/http/client.rb +27 -24
  13. data/lib/http/connection.rb +6 -4
  14. data/lib/http/content_type.rb +1 -0
  15. data/lib/http/errors.rb +3 -2
  16. data/lib/http/feature.rb +2 -1
  17. data/lib/http/features/auto_deflate.rb +77 -20
  18. data/lib/http/features/auto_inflate.rb +2 -1
  19. data/lib/http/headers.rb +3 -2
  20. data/lib/http/headers/known.rb +23 -22
  21. data/lib/http/headers/mixin.rb +1 -0
  22. data/lib/http/mime_type.rb +1 -0
  23. data/lib/http/mime_type/adapter.rb +2 -1
  24. data/lib/http/mime_type/json.rb +2 -1
  25. data/lib/http/options.rb +15 -12
  26. data/lib/http/redirector.rb +4 -3
  27. data/lib/http/request.rb +25 -10
  28. data/lib/http/request/body.rb +67 -0
  29. data/lib/http/request/writer.rb +32 -37
  30. data/lib/http/response.rb +17 -2
  31. data/lib/http/response/body.rb +16 -12
  32. data/lib/http/response/parser.rb +1 -0
  33. data/lib/http/response/status.rb +1 -0
  34. data/lib/http/response/status/reasons.rb +1 -0
  35. data/lib/http/timeout/global.rb +1 -0
  36. data/lib/http/timeout/null.rb +2 -1
  37. data/lib/http/timeout/per_operation.rb +19 -6
  38. data/lib/http/uri.rb +8 -2
  39. data/lib/http/version.rb +1 -1
  40. data/spec/lib/http/client_spec.rb +104 -4
  41. data/spec/lib/http/content_type_spec.rb +1 -0
  42. data/spec/lib/http/features/auto_deflate_spec.rb +32 -64
  43. data/spec/lib/http/features/auto_inflate_spec.rb +1 -0
  44. data/spec/lib/http/headers/mixin_spec.rb +1 -0
  45. data/spec/lib/http/headers_spec.rb +36 -35
  46. data/spec/lib/http/options/body_spec.rb +1 -0
  47. data/spec/lib/http/options/features_spec.rb +1 -0
  48. data/spec/lib/http/options/form_spec.rb +1 -0
  49. data/spec/lib/http/options/headers_spec.rb +2 -1
  50. data/spec/lib/http/options/json_spec.rb +1 -0
  51. data/spec/lib/http/options/new_spec.rb +2 -1
  52. data/spec/lib/http/options/proxy_spec.rb +1 -0
  53. data/spec/lib/http/options_spec.rb +1 -0
  54. data/spec/lib/http/redirector_spec.rb +1 -0
  55. data/spec/lib/http/request/body_spec.rb +138 -0
  56. data/spec/lib/http/request/writer_spec.rb +44 -74
  57. data/spec/lib/http/request_spec.rb +14 -0
  58. data/spec/lib/http/response/body_spec.rb +20 -4
  59. data/spec/lib/http/response/status_spec.rb +27 -26
  60. data/spec/lib/http/response_spec.rb +10 -0
  61. data/spec/lib/http/uri_spec.rb +11 -0
  62. data/spec/lib/http_spec.rb +18 -6
  63. data/spec/regression_specs.rb +1 -0
  64. data/spec/spec_helper.rb +1 -0
  65. data/spec/support/black_hole.rb +9 -2
  66. data/spec/support/capture_warning.rb +1 -0
  67. data/spec/support/dummy_server.rb +2 -1
  68. data/spec/support/dummy_server/servlet.rb +1 -1
  69. data/spec/support/fakeio.rb +21 -0
  70. data/spec/support/http_handling_shared.rb +1 -0
  71. data/spec/support/proxy_server.rb +1 -0
  72. data/spec/support/servers/config.rb +1 -0
  73. data/spec/support/servers/runner.rb +1 -0
  74. data/spec/support/ssl_helper.rb +3 -2
  75. metadata +20 -9
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options, "body" do
3
4
  let(:opts) { HTTP::Options.new }
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options, "features" do
3
4
  let(:opts) { HTTP::Options.new }
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options, "form" do
3
4
  let(:opts) { HTTP::Options.new }
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options, "headers" do
3
4
  let(:opts) { HTTP::Options.new }
4
5
 
@@ -9,7 +10,7 @@ RSpec.describe HTTP::Options, "headers" do
9
10
  it "may be specified with with_headers" do
10
11
  opts2 = opts.with_headers("accept" => "json")
11
12
  expect(opts.headers).to be_empty
12
- expect(opts2.headers).to eq([%w(Accept json)])
13
+ expect(opts2.headers).to eq([%w[Accept json]])
13
14
  end
14
15
 
15
16
  it "accepts any object that respond to :to_hash" do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options, "json" do
3
4
  let(:opts) { HTTP::Options.new }
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options, "new" do
3
4
  it "supports a Options instance" do
4
5
  opts = HTTP::Options.new
@@ -13,7 +14,7 @@ RSpec.describe HTTP::Options, "new" do
13
14
 
14
15
  it "coerces :headers correctly" do
15
16
  opts = HTTP::Options.new(:headers => {:accept => "json"})
16
- expect(opts.headers).to eq([%w(Accept json)])
17
+ expect(opts.headers).to eq([%w[Accept json]])
17
18
  end
18
19
 
19
20
  it "coerces :proxy correctly" do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options, "proxy" do
3
4
  let(:opts) { HTTP::Options.new }
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Options do
3
4
  subject { described_class.new(:response => :body) }
4
5
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Redirector do
3
4
  def simple_response(status, body = "", headers = {})
4
5
  HTTP::Response.new(
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe HTTP::Request::Body do
4
+ let(:body) { "" }
5
+ subject { HTTP::Request::Body.new(body) }
6
+
7
+ describe "#initialize" do
8
+ context "when body is nil" do
9
+ let(:body) { nil }
10
+
11
+ it "does not raise an error" do
12
+ expect { subject }.not_to raise_error
13
+ end
14
+ end
15
+
16
+ context "when body is a string" do
17
+ let(:body) { "string body" }
18
+
19
+ it "does not raise an error" do
20
+ expect { subject }.not_to raise_error
21
+ end
22
+ end
23
+
24
+ context "when body is an IO" do
25
+ let(:body) { FakeIO.new("IO body") }
26
+
27
+ it "does not raise an error" do
28
+ expect { subject }.not_to raise_error
29
+ end
30
+ end
31
+
32
+ context "when body is an Enumerable" do
33
+ let(:body) { %w[bees cows] }
34
+
35
+ it "does not raise an error" do
36
+ expect { subject }.not_to raise_error
37
+ end
38
+ end
39
+
40
+ context "when body is of unrecognized type" do
41
+ let(:body) { 123 }
42
+
43
+ it "raises an error" do
44
+ expect { subject }.to raise_error(HTTP::RequestError)
45
+ end
46
+ end
47
+ end
48
+
49
+ describe "#size" do
50
+ context "when body is nil" do
51
+ let(:body) { nil }
52
+
53
+ it "returns zero" do
54
+ expect(subject.size).to eq 0
55
+ end
56
+ end
57
+
58
+ context "when body is a string" do
59
+ let(:body) { "Привет, мир!" }
60
+
61
+ it "returns string bytesize" do
62
+ expect(subject.size).to eq 21
63
+ end
64
+ end
65
+
66
+ context "when body is an IO with size" do
67
+ let(:body) { FakeIO.new("content") }
68
+
69
+ it "returns IO size" do
70
+ expect(subject.size).to eq 7
71
+ end
72
+ end
73
+
74
+ context "when body is an IO without size" do
75
+ let(:body) { IO.pipe[0] }
76
+
77
+ it "raises a RequestError" do
78
+ expect { subject.size }.to raise_error(HTTP::RequestError)
79
+ end
80
+ end
81
+
82
+ context "when body is an Enumerable" do
83
+ let(:body) { %w[bees cows] }
84
+
85
+ it "raises a RequestError" do
86
+ expect { subject.size }.to raise_error(HTTP::RequestError)
87
+ end
88
+ end
89
+ end
90
+
91
+ describe "#each" do
92
+ let(:chunks) do
93
+ chunks = []
94
+ subject.each { |chunk| chunks << chunk.dup }
95
+ chunks
96
+ end
97
+
98
+ context "when body is nil" do
99
+ let(:body) { nil }
100
+
101
+ it "yields nothing" do
102
+ expect(chunks).to eq []
103
+ end
104
+ end
105
+
106
+ context "when body is a string" do
107
+ let(:body) { "content" }
108
+
109
+ it "yields the string" do
110
+ expect(chunks).to eq %w[content]
111
+ end
112
+ end
113
+
114
+ context "when body is a non-Enumerable IO" do
115
+ let(:body) { FakeIO.new("a" * 16 * 1024 + "b" * 10 * 1024) }
116
+
117
+ it "yields chunks of content" do
118
+ expect(chunks.inject("", :+)).to eq "a" * 16 * 1024 + "b" * 10 * 1024
119
+ end
120
+ end
121
+
122
+ context "when body is an Enumerable IO" do
123
+ let(:body) { StringIO.new("a" * 16 * 1024 + "b" * 10 * 1024) }
124
+
125
+ it "yields chunks of content" do
126
+ expect(chunks.inject("", :+)).to eq "a" * 16 * 1024 + "b" * 10 * 1024
127
+ end
128
+ end
129
+
130
+ context "when body is an Enumerable" do
131
+ let(:body) { %w[bees cows] }
132
+
133
+ it "yields elements" do
134
+ expect(chunks).to eq %w[bees cows]
135
+ end
136
+ end
137
+ end
138
+ end
@@ -3,105 +3,75 @@
3
3
 
4
4
  RSpec.describe HTTP::Request::Writer do
5
5
  let(:io) { StringIO.new }
6
- let(:body) { "" }
6
+ let(:body) { HTTP::Request::Body.new("") }
7
7
  let(:headers) { HTTP::Headers.new }
8
8
  let(:headerstart) { "GET /test HTTP/1.1" }
9
9
 
10
10
  subject(:writer) { described_class.new(io, body, headers, headerstart) }
11
11
 
12
- describe "#initalize" do
13
- context "when body is nil" do
14
- let(:body) { nil }
15
-
16
- it "does not raise an error" do
17
- expect { writer }.not_to raise_error
18
- end
19
- end
20
-
21
- context "when body is a string" do
22
- let(:body) { "string body" }
23
-
24
- it "does not raise an error" do
25
- expect { writer }.not_to raise_error
26
- end
27
- end
28
-
29
- context "when body is an Enumerable" do
30
- let(:body) { %w(bees cows) }
12
+ describe "#stream" do
13
+ context "when multiple headers are set" do
14
+ let(:headers) { HTTP::Headers.coerce "Host" => "example.org" }
31
15
 
32
- it "does not raise an error" do
33
- expect { writer }.not_to raise_error
16
+ it "separates headers with carriage return and line feed" do
17
+ writer.stream
18
+ expect(io.string).to eq [
19
+ "#{headerstart}\r\n",
20
+ "Host: example.org\r\nContent-Length: 0\r\n\r\n"
21
+ ].join
34
22
  end
35
23
  end
36
24
 
37
- context "when body is not string, enumerable or nil" do
38
- let(:body) { 123 }
25
+ context "when body is nonempty" do
26
+ let(:body) { HTTP::Request::Body.new("content") }
39
27
 
40
- it "raises an error" do
41
- expect { writer }.to raise_error(HTTP::RequestError)
28
+ it "writes it to the socket and sets Content-Length" do
29
+ writer.stream
30
+ expect(io.string).to eq [
31
+ "#{headerstart}\r\n",
32
+ "Content-Length: 7\r\n\r\n",
33
+ "content"
34
+ ].join
42
35
  end
43
36
  end
44
- end
45
-
46
- describe "#stream" do
47
- context "when body is Enumerable" do
48
- let(:body) { %w(bees cows) }
49
- let(:headers) { HTTP::Headers.coerce "Transfer-Encoding" => "chunked" }
50
37
 
51
- it "writes a chunked request from an Enumerable correctly" do
52
- writer.stream
53
- expect(io.string).to end_with "\r\n4\r\nbees\r\n4\r\ncows\r\n0\r\n\r\n"
54
- end
38
+ context "when body is empty" do
39
+ let(:body) { HTTP::Request::Body.new(nil) }
55
40
 
56
- it "writes Transfer-Encoding header only once" do
41
+ it "doesn't write anything to the socket and sets Content-Length" do
57
42
  writer.stream
58
- expect(io.string).to start_with "#{headerstart}\r\nTransfer-Encoding: chunked\r\n\r\n"
59
- end
60
-
61
- context "when Transfer-Encoding not set" do
62
- let(:headers) { HTTP::Headers.new }
63
- specify { expect { writer.stream }.to raise_error(HTTP::RequestError) }
64
- end
65
-
66
- context "when Transfer-Encoding is not chunked" do
67
- let(:headers) { HTTP::Headers.coerce "Transfer-Encoding" => "gzip" }
68
- specify { expect { writer.stream }.to raise_error(HTTP::RequestError) }
43
+ expect(io.string).to eq [
44
+ "#{headerstart}\r\n",
45
+ "Content-Length: 0\r\n\r\n"
46
+ ].join
69
47
  end
70
48
  end
71
49
 
72
- context "when body is nil" do
73
- let(:body) { nil }
50
+ context "when Content-Length header is set" do
51
+ let(:headers) { HTTP::Headers.coerce "Content-Length" => "12" }
52
+ let(:body) { HTTP::Request::Body.new("content") }
74
53
 
75
- it "properly sets Content-Length header if needed" do
54
+ it "keeps the given value" do
76
55
  writer.stream
77
- expect(io.string).to start_with "#{headerstart}\r\nContent-Length: 0\r\n\r\n"
78
- end
79
-
80
- context "when Content-Length explicitly set" do
81
- let(:headers) { HTTP::Headers.coerce "Content-Length" => 12 }
82
-
83
- it "keeps given value" do
84
- writer.stream
85
- expect(io.string).to start_with "#{headerstart}\r\nContent-Length: 12\r\n\r\n"
86
- end
56
+ expect(io.string).to eq [
57
+ "#{headerstart}\r\n",
58
+ "Content-Length: 12\r\n\r\n",
59
+ "content"
60
+ ].join
87
61
  end
88
62
  end
89
63
 
90
- context "when body is a unicode String" do
91
- let(:body) { "Привет, мир!" }
64
+ context "when Transfer-Encoding is chunked" do
65
+ let(:headers) { HTTP::Headers.coerce "Transfer-Encoding" => "chunked" }
66
+ let(:body) { HTTP::Request::Body.new(%w[request body]) }
92
67
 
93
- it "properly calculates Content-Length if needed" do
68
+ it "writes encoded content and omits Content-Length" do
94
69
  writer.stream
95
- expect(io.string).to start_with "#{headerstart}\r\nContent-Length: 21\r\n\r\n"
96
- end
97
-
98
- context "when Content-Length explicitly set" do
99
- let(:headers) { HTTP::Headers.coerce "Content-Length" => 12 }
100
-
101
- it "keeps given value" do
102
- writer.stream
103
- expect(io.string).to start_with "#{headerstart}\r\nContent-Length: 12\r\n\r\n"
104
- end
70
+ expect(io.string).to eq [
71
+ "#{headerstart}\r\n",
72
+ "Transfer-Encoding: chunked\r\n\r\n",
73
+ "7\r\nrequest\r\n4\r\nbody\r\n0\r\n\r\n"
74
+ ].join
105
75
  end
106
76
  end
107
77
  end
@@ -94,6 +94,20 @@ RSpec.describe HTTP::Request do
94
94
  expect(redirected["Host"]).to eq "blog.example.com"
95
95
  end
96
96
 
97
+ context "with URL with non-standard port given" do
98
+ subject(:redirected) { request.redirect "http://example.com:8080" }
99
+
100
+ its(:uri) { is_expected.to eq HTTP::URI.parse "http://example.com:8080" }
101
+
102
+ its(:verb) { is_expected.to eq request.verb }
103
+ its(:body) { is_expected.to eq request.body }
104
+ its(:proxy) { is_expected.to eq request.proxy }
105
+
106
+ it "presets new Host header" do
107
+ expect(redirected["Host"]).to eq "example.com:8080"
108
+ end
109
+ end
110
+
97
111
  context "with schema-less absolute URL given" do
98
112
  subject(:redirected) { request.redirect "//another.example.com/blog" }
99
113
 
@@ -1,11 +1,15 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Response::Body do
3
4
  let(:connection) { double(:sequence_id => 0) }
4
5
  let(:chunks) { [String.new("Hello, "), String.new("World!")] }
5
6
 
6
- before { allow(connection).to receive(:readpartial) { chunks.shift } }
7
+ before do
8
+ allow(connection).to receive(:readpartial) { chunks.shift }
9
+ allow(connection).to receive(:body_completed?) { chunks.empty? }
10
+ end
7
11
 
8
- subject(:body) { described_class.new(connection, Encoding::UTF_8) }
12
+ subject(:body) { described_class.new(connection, :encoding => Encoding::UTF_8) }
9
13
 
10
14
  it "streams bodies from responses" do
11
15
  expect(subject.to_s).to eq("Hello, World!")
@@ -37,6 +41,18 @@ RSpec.describe HTTP::Response::Body do
37
41
  body.readpartial
38
42
  end
39
43
  end
44
+
45
+ it "returns content in specified encoding" do
46
+ body = described_class.new(connection)
47
+ expect(connection).to receive(:readpartial).
48
+ and_return(String.new("content").force_encoding(Encoding::UTF_8))
49
+ expect(body.readpartial.encoding).to eq Encoding::BINARY
50
+
51
+ body = described_class.new(connection, :encoding => Encoding::UTF_8)
52
+ expect(connection).to receive(:readpartial).
53
+ and_return(String.new("content").force_encoding(Encoding::BINARY))
54
+ expect(body.readpartial.encoding).to eq Encoding::UTF_8
55
+ end
40
56
  end
41
57
 
42
58
  context "when body is gzipped" do
@@ -47,7 +63,7 @@ RSpec.describe HTTP::Response::Body do
47
63
  end
48
64
  subject(:body) do
49
65
  inflater = HTTP::Response::Inflater.new(connection)
50
- described_class.new(inflater, Encoding::UTF_8)
66
+ described_class.new(inflater, :encoding => Encoding::UTF_8)
51
67
  end
52
68
 
53
69
  it "decodes body" do
@@ -58,7 +74,7 @@ RSpec.describe HTTP::Response::Body do
58
74
  it "streams decoded body" do
59
75
  [
60
76
  "Hi, HTTP ",
61
- String.new("here ☺").force_encoding("ASCII-8BIT"),
77
+ "here ☺",
62
78
  nil
63
79
  ].each do |part|
64
80
  expect(subject.readpartial).to eq(part)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  RSpec.describe HTTP::Response::Status do
3
4
  describe ".new" do
4
5
  it "fails if given value does not respond to #to_i" do
@@ -13,7 +14,7 @@ RSpec.describe HTTP::Response::Status do
13
14
  describe "#code" do
14
15
  subject { described_class.new("200.0").code }
15
16
  it { is_expected.to eq 200 }
16
- it { is_expected.to be_a Fixnum }
17
+ it { is_expected.to be_a Integer }
17
18
  end
18
19
 
19
20
  describe "#reason" do
@@ -39,23 +40,23 @@ RSpec.describe HTTP::Response::Status do
39
40
  subject { (100...200).map { |code| described_class.new code } }
40
41
 
41
42
  it "is #informational?" do
42
- expect(subject).to all satisfy(&:informational?)
43
+ expect(subject).to all(satisfy(&:informational?))
43
44
  end
44
45
 
45
46
  it "is not #success?" do
46
- expect(subject).to all satisfy { |status| !status.success? }
47
+ expect(subject).to all(satisfy { |status| !status.success? })
47
48
  end
48
49
 
49
50
  it "is not #redirect?" do
50
- expect(subject).to all satisfy { |status| !status.redirect? }
51
+ expect(subject).to all(satisfy { |status| !status.redirect? })
51
52
  end
52
53
 
53
54
  it "is not #client_error?" do
54
- expect(subject).to all satisfy { |status| !status.client_error? }
55
+ expect(subject).to all(satisfy { |status| !status.client_error? })
55
56
  end
56
57
 
57
58
  it "is not #server_error?" do
58
- expect(subject).to all satisfy { |status| !status.server_error? }
59
+ expect(subject).to all(satisfy { |status| !status.server_error? })
59
60
  end
60
61
  end
61
62
 
@@ -63,23 +64,23 @@ RSpec.describe HTTP::Response::Status do
63
64
  subject { (200...300).map { |code| described_class.new code } }
64
65
 
65
66
  it "is not #informational?" do
66
- expect(subject).to all satisfy { |status| !status.informational? }
67
+ expect(subject).to all(satisfy { |status| !status.informational? })
67
68
  end
68
69
 
69
70
  it "is #success?" do
70
- expect(subject).to all satisfy(&:success?)
71
+ expect(subject).to all(satisfy(&:success?))
71
72
  end
72
73
 
73
74
  it "is not #redirect?" do
74
- expect(subject).to all satisfy { |status| !status.redirect? }
75
+ expect(subject).to all(satisfy { |status| !status.redirect? })
75
76
  end
76
77
 
77
78
  it "is not #client_error?" do
78
- expect(subject).to all satisfy { |status| !status.client_error? }
79
+ expect(subject).to all(satisfy { |status| !status.client_error? })
79
80
  end
80
81
 
81
82
  it "is not #server_error?" do
82
- expect(subject).to all satisfy { |status| !status.server_error? }
83
+ expect(subject).to all(satisfy { |status| !status.server_error? })
83
84
  end
84
85
  end
85
86
 
@@ -87,23 +88,23 @@ RSpec.describe HTTP::Response::Status do
87
88
  subject { (300...400).map { |code| described_class.new code } }
88
89
 
89
90
  it "is not #informational?" do
90
- expect(subject).to all satisfy { |status| !status.informational? }
91
+ expect(subject).to all(satisfy { |status| !status.informational? })
91
92
  end
92
93
 
93
94
  it "is not #success?" do
94
- expect(subject).to all satisfy { |status| !status.success? }
95
+ expect(subject).to all(satisfy { |status| !status.success? })
95
96
  end
96
97
 
97
98
  it "is #redirect?" do
98
- expect(subject).to all satisfy(&:redirect?)
99
+ expect(subject).to all(satisfy(&:redirect?))
99
100
  end
100
101
 
101
102
  it "is not #client_error?" do
102
- expect(subject).to all satisfy { |status| !status.client_error? }
103
+ expect(subject).to all(satisfy { |status| !status.client_error? })
103
104
  end
104
105
 
105
106
  it "is not #server_error?" do
106
- expect(subject).to all satisfy { |status| !status.server_error? }
107
+ expect(subject).to all(satisfy { |status| !status.server_error? })
107
108
  end
108
109
  end
109
110
 
@@ -111,23 +112,23 @@ RSpec.describe HTTP::Response::Status do
111
112
  subject { (400...500).map { |code| described_class.new code } }
112
113
 
113
114
  it "is not #informational?" do
114
- expect(subject).to all satisfy { |status| !status.informational? }
115
+ expect(subject).to all(satisfy { |status| !status.informational? })
115
116
  end
116
117
 
117
118
  it "is not #success?" do
118
- expect(subject).to all satisfy { |status| !status.success? }
119
+ expect(subject).to all(satisfy { |status| !status.success? })
119
120
  end
120
121
 
121
122
  it "is not #redirect?" do
122
- expect(subject).to all satisfy { |status| !status.redirect? }
123
+ expect(subject).to all(satisfy { |status| !status.redirect? })
123
124
  end
124
125
 
125
126
  it "is #client_error?" do
126
- expect(subject).to all satisfy(&:client_error?)
127
+ expect(subject).to all(satisfy(&:client_error?))
127
128
  end
128
129
 
129
130
  it "is not #server_error?" do
130
- expect(subject).to all satisfy { |status| !status.server_error? }
131
+ expect(subject).to all(satisfy { |status| !status.server_error? })
131
132
  end
132
133
  end
133
134
 
@@ -135,23 +136,23 @@ RSpec.describe HTTP::Response::Status do
135
136
  subject { (500...600).map { |code| described_class.new code } }
136
137
 
137
138
  it "is not #informational?" do
138
- expect(subject).to all satisfy { |status| !status.informational? }
139
+ expect(subject).to all(satisfy { |status| !status.informational? })
139
140
  end
140
141
 
141
142
  it "is not #success?" do
142
- expect(subject).to all satisfy { |status| !status.success? }
143
+ expect(subject).to all(satisfy { |status| !status.success? })
143
144
  end
144
145
 
145
146
  it "is not #redirect?" do
146
- expect(subject).to all satisfy { |status| !status.redirect? }
147
+ expect(subject).to all(satisfy { |status| !status.redirect? })
147
148
  end
148
149
 
149
150
  it "is not #client_error?" do
150
- expect(subject).to all satisfy { |status| !status.client_error? }
151
+ expect(subject).to all(satisfy { |status| !status.client_error? })
151
152
  end
152
153
 
153
154
  it "is #server_error?" do
154
- expect(subject).to all satisfy(&:server_error?)
155
+ expect(subject).to all(satisfy(&:server_error?))
155
156
  end
156
157
  end
157
158