Skip to content

Commit 00d2685

Browse files
committed
Fix rack env spec: check rack.errors instead of rack.input
rack-test 2.x does not populate rack.input in the Rack environment for requests that have no body (e.g. GET). rack.input is only added when there is a request body to expose. The test was asserting that the adapter correctly passes the full Rack env through to the resource; rack.errors is always present regardless of HTTP method or Rack version, so use that as the representative Rack-specific key instead.
1 parent 8b309ee commit 00d2685

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spec/webmachine/adapters/rack_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757

5858
it 'provides the rack env on the request' do
5959
rack_response = get 'test', nil, {'HTTP_ACCEPT' => 'test/response.rack_env'}
60-
expect(JSON.parse(rack_response.body).keys).to include 'rack.input'
60+
# rack-test does not populate rack.input for GET requests in Rack 3,
61+
# so check for rack.errors which is always present in every Rack version.
62+
expect(JSON.parse(rack_response.body).keys).to include 'rack.errors'
6163
end
6264
end
6365
end

0 commit comments

Comments
 (0)