-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support have_http_status
with Rack::MockResponse
#2771
Support have_http_status
with Rack::MockResponse
#2771
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please provide a reproduction script a-la #2502 (comment) ?
I added one in the description. Thanks for pointing to a nice example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Thanks for drawing this to our attention, I think the simpler solution would be to both construct a real Rack::MockResponse
in the test, and just match on that earlier.
690fb49
to
56f26a1
Compare
Thanks! |
…-have-http-status Support `have_http_status` with `Rack::MockResponse`
Released in 6.1.4 |
When using
rack-test
, doing something likeexpect(last_response).to have_http_status(:ok)
would fail with the error "expected a response object, but an instance of Rack::MockResponse was received".This PR creates a
ActionDispatch::TestResponse
from theRack::MockResponse
to makehave_http_status
usable in specs relying onrack-test
to perform requests.It should fix rubocop/rubocop-rspec_rails#20.
Reproduction script: