Interestingly, in some cases, "redirect_to :back" has problems when used in integration tests with Rails. I just found a webpage with some helpful tips, for me, the magic words were:
post_via_redirect '/account/login', {:login => '6044851111', :password => 'bad_password'}, {:referer => "/account/login"}
That extra hash at the end there with the options for :referer is what you need.