|
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 not be informational" do |
| 29 | + expect(response).not.to be(:informational?) |
| 30 | + end |
| 31 | + |
18 | 32 | it "should not be a failure" do |
19 | 33 | expect(response).not.to be(:failure?) |
20 | 34 | end |
|
25 | 39 | expect(response).to be(:redirection?) |
26 | 40 | end |
27 | 41 |
|
| 42 | + it "should not be informational" do |
| 43 | + expect(response).not.to be(:informational?) |
| 44 | + end |
| 45 | + |
28 | 46 | it "should not be a failure" do |
29 | 47 | expect(response).not.to be(:failure?) |
30 | 48 | end |
|
35 | 53 | expect(response).not.to be(:success?) |
36 | 54 | end |
37 | 55 |
|
| 56 | + it "should not be informational" do |
| 57 | + expect(response).not.to be(:informational?) |
| 58 | + end |
| 59 | + |
38 | 60 | it "should be a failure" do |
39 | 61 | expect(response).to be(:failure?) |
40 | 62 | end |
|
51 | 73 | expect(response).not.to be(:preserve_method?) |
52 | 74 | end |
53 | 75 | end |
54 | | - |
| 76 | + |
| 77 | + with "100 Continue" do |
| 78 | + let(:response) {subject.new("HTTP/1.1", 100, headers)} |
| 79 | + |
| 80 | + it "should have attributes" do |
| 81 | + expect(response).to have_attributes( |
| 82 | + version: be == "HTTP/1.1", |
| 83 | + status: be == 100, |
| 84 | + headers: be == headers, |
| 85 | + body: be == nil, |
| 86 | + protocol: be == nil |
| 87 | + ) |
| 88 | + end |
| 89 | + |
| 90 | + it_behaves_like InformationalResponse |
| 91 | + |
| 92 | + it "should be a continue" do |
| 93 | + expect(response).to be(:continue?) |
| 94 | + end |
| 95 | + |
| 96 | + it "should not be a failure" do |
| 97 | + expect(response).not.to be(:failure?) |
| 98 | + end |
| 99 | + |
| 100 | + it "should have a String representation" do |
| 101 | + expect(response.to_s).to be == "100 HTTP/1.1" |
| 102 | + end |
| 103 | + |
| 104 | + it "should have an Array representation" do |
| 105 | + expect(response.to_ary).to be == [100, headers, nil] |
| 106 | + end |
| 107 | + end |
55 | 108 |
|
56 | 109 | with "301 Moved Permanently" do |
57 | 110 | let(:response) {subject.new("HTTP/1.1", 301, headers, body)} |
|
0 commit comments