rspec-openapi icon indicating copy to clipboard operation
rspec-openapi copied to clipboard

bug: response received unexpected message :status with (no args)

Open Spence1115 opened this issue 7 months ago • 1 comments
trafficstars

Summary

If you use the words request or response for a variable in your tests, rspec-openapi will not work. I know these are preassigned words in rspec itself, but the use of them as variables does not break rspec, so I wouldn't expect it to break rspec-openapi.

Reproduction

...
describe "#index" do
  subject { get :index }
  
  before do
    allow(SomeThirdPartyGem).to receive(:call).and_return(response)
  end

  let(:response) { double(ThirdPartyGemResponse, body: "This succeeded", code: 200) }

  it "renders the index successfully" do
    expect(subject.status).to eq(200)
  end
end

When just running the test, rspec succeeds fine. When running openapi-rspec:

\e[1mFailure/Error: \e[0mexample.run
  #<Double ThirdPartyGemResponse> received unexpected message :status with (no args)

Spence1115 avatar Mar 29 '25 08:03 Spence1115