How do you test redirect_to :back in rspec?
I get
ActionController::RedirectBackError:
NoHTTP_REFERERwas set in the request to this action, soredirect_to :backcould not be called successfully. If this is a test, make sure to specifyrequest.env["HTTP_REFERER"].
How do I go about setting the HTTP_REFERER in my test?
Using RSpec, you can set the referer in a
beforeblock. When I tried to set the referer directly in the test, it didn’t seem to work no matter where I put it, but the before block does the trick.