title: How do i set a request.referrer inside my RSpec?
body: <p>I am trying to avoid using my <code>session[:referred_by]</code>, and would like to use the <code>request.referrer</code>.  However, my RSpec tests fail because the <code>TestRequest</code> does not store a <code>request.referrer</code></p>
  
  <p>So I have to do the following in order for Rspec tests to work. Is there a way to make it better:</p>
  
  <pre><code>referrer = request.referrer ? request.referrer : '/'
  redirect_to referrer, :alert =&gt; error_message
  </code></pre>