Skip to content

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

@Spence1115

Description

@Spence1115

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions