Currently got this error message after executing my RSpec tests:
ActionController::RedirectBackError: No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].
The error message and Stackoverflow tells you to set request.env[“HTTP_REFERER”]. I did that:
request.env["HTTP_REFERER"] = "/signin"
But that didn’t helped. Instead of that I set the HTTP_REFERRER directly in the post. Here is the snippet from my test code:
post "/sessions", {:session => {:email => user.email, :password => user.password}}, {"HTTPS" => "on", 'HTTP_REFERER' => '/signin'}
That fixed my problem.