Skip to content

Request specs fail after upgrading to Rack 3 #2814

Open
@cjamison

Description

@cjamison

We have a number of request specs for our API and after upgrading Rack from 2.x to 3.x, they all started failing with:

     Failure/Error: get "/api/v1/products/1", headers: @headers
     
     NoMethodError:
       undefined method `read' for nil:NilClass

The way to resolve these errors is to convert the get request to

get "/api/v1/products/1", headers: @headers, env: { 'rack.input' => StringIO.new }

However, it seems very verbose to add this to each request. Am I missing an easier / better way to avoid this error?

This is on rspec-rails 7.1.0 and rspec-core 3.13.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions