|
10 | 10 | let(:headers) {Protocol::HTTP::Headers.new}
|
11 | 11 | let(:body) {nil}
|
12 | 12 |
|
| 13 | + InformationalResponse = Sus::Shared("informational response") do |
| 14 | + it "should be informational" do |
| 15 | + expect(response).to be(:informational?) |
| 16 | + end |
| 17 | + |
| 18 | + it "should not be a failure" do |
| 19 | + expect(response).not.to be(:failure?) |
| 20 | + end |
| 21 | + end |
| 22 | + |
13 | 23 | SuccessfulResponse = Sus::Shared("successful response") do
|
14 | 24 | it "should be successful" do
|
15 | 25 | expect(response).to be(:success?)
|
16 | 26 | end
|
17 | 27 |
|
| 28 | + it "should be final" do |
| 29 | + expect(response).to be(:final?) |
| 30 | + end |
| 31 | + |
| 32 | + it "should not be informational" do |
| 33 | + expect(response).not.to be(:informational?) |
| 34 | + end |
| 35 | + |
18 | 36 | it "should not be a failure" do
|
19 | 37 | expect(response).not.to be(:failure?)
|
20 | 38 | end
|
21 | 39 | end
|
22 | 40 |
|
23 | 41 | RedirectionResponse = Sus::Shared("redirection response") do
|
| 42 | + it "should be final" do |
| 43 | + expect(response).to be(:final?) |
| 44 | + end |
| 45 | + |
24 | 46 | it "should be a redirection" do
|
25 | 47 | expect(response).to be(:redirection?)
|
26 | 48 | end
|
27 | 49 |
|
| 50 | + it "should not be informational" do |
| 51 | + expect(response).not.to be(:informational?) |
| 52 | + end |
| 53 | + |
28 | 54 | it "should not be a failure" do
|
29 | 55 | expect(response).not.to be(:failure?)
|
30 | 56 | end
|
|
35 | 61 | expect(response).not.to be(:success?)
|
36 | 62 | end
|
37 | 63 |
|
| 64 | + it "should be final" do |
| 65 | + expect(response).to be(:final?) |
| 66 | + end |
| 67 | + |
| 68 | + it "should not be informational" do |
| 69 | + expect(response).not.to be(:informational?) |
| 70 | + end |
| 71 | + |
38 | 72 | it "should be a failure" do
|
39 | 73 | expect(response).to be(:failure?)
|
40 | 74 | end
|
|
51 | 85 | expect(response).not.to be(:preserve_method?)
|
52 | 86 | end
|
53 | 87 | end
|
54 |
| - |
| 88 | + |
| 89 | + with "100 Continue" do |
| 90 | + let(:response) {subject.new("HTTP/1.1", 100, headers)} |
| 91 | + |
| 92 | + it "should have attributes" do |
| 93 | + expect(response).to have_attributes( |
| 94 | + version: be == "HTTP/1.1", |
| 95 | + status: be == 100, |
| 96 | + headers: be == headers, |
| 97 | + body: be == nil, |
| 98 | + protocol: be == nil |
| 99 | + ) |
| 100 | + end |
| 101 | + |
| 102 | + it_behaves_like InformationalResponse |
| 103 | + |
| 104 | + it "should be a continue" do |
| 105 | + expect(response).to be(:continue?) |
| 106 | + end |
| 107 | + |
| 108 | + it "should have a String representation" do |
| 109 | + expect(response.to_s).to be == "100 HTTP/1.1" |
| 110 | + end |
| 111 | + |
| 112 | + it "should have an Array representation" do |
| 113 | + expect(response.to_ary).to be == [100, headers, nil] |
| 114 | + end |
| 115 | + end |
55 | 116 |
|
56 | 117 | with "301 Moved Permanently" do
|
57 | 118 | let(:response) {subject.new("HTTP/1.1", 301, headers, body)}
|
|
0 commit comments