Rails success? predicate deprecation
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
I've been running a new Rails project up on the master
branch while having a play with the new ActiveStorage module to see if it will be a good fit. Running the test suite this morning though I found that the RSpec output was littered with these deprecation warnings:
It turns out that my use of expect(response).to have_http_status :success
is now the old way of doing things. While the error message wasn't particularly clear as to what to do, I worked it out. Here are some of the ways you can update your code and remove the deprecation warning.