Commit 5cb828f
Rack response needs to be finished when returned from the Rack application
This merge request addresses the following test failures:
```
1) Thrift::ThinHTTPServer::RackApplication 404 response receives a non-POST
Failure/Error: expect(last_response.status).to be 404
expected #<Integer:809> => 404
got #<Integer:1001> => 500
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
# ./spec/thin_http_server_spec.rb:102:in 'block (3 levels) in <top (required)>'
2) Thrift::ThinHTTPServer::RackApplication 404 response receives a header other than application/x-thrift
Failure/Error: expect(last_response.status).to be 404
expected #<Integer:809> => 404
got #<Integer:1001> => 500
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
# ./spec/thin_http_server_spec.rb:108:in 'block (3 levels) in <top (required)>'
3) Thrift::ThinHTTPServer::RackApplication 200 response status code 200
Failure/Error: expect(last_response.ok?).to be_truthy
expected: truthy value
got: false
# ./spec/thin_http_server_spec.rb:135:in 'block (3 levels) in <top (required)>'
```
From the [Rack documentation](https://rack.github.io/rack/2.2/Rack/Response.html),
> Your application’s call should end returning [Response#finish](https://rack.github.io/rack/2.2/Rack/Response.html#method-i-finish).
Additionally:
* using identity checks on integers produces weird expectation "expected #<Integer:809> => 404", which is not necessary. Switched to using `eq` matcher
* `be_truthy` matcher is overly generic and identity matching on `true`/`false` is preferred: "expected true" output will be displayed on failure1 parent 5c2183d commit 5cb828f
File tree
2 files changed
+5
-6
lines changed- lib/rb
- lib/thrift/server
- spec
2 files changed
+5
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
0 commit comments