title: Testing routing redirects using rspec
body: <p>I have a routing issue with Rails and Rspec that I can't work out. </p>
  
  <p>In my routes.rb file I have set up some redirects as follows:</p>
  
  <pre><code>match "/events" =&gt; redirect("/albums")
  match "/events/:id" =&gt; redirect("/albums/%{id}")
  </code></pre>
  
  <p>This works, but I can't work out how to test it. I was hoping I could do something like</p>
  
  <pre><code> { :get =&gt; "/events" }.should route_to(:controller =&gt; "events", :action =&gt; "index")
  </code></pre>
  
  <p>or</p>
  
  <pre><code> { :get =&gt; "/events" }.should redirect_to("/albums")
  </code></pre>
  
  <p>however neither of these options seems to work. </p>
  
  <p>Creating the normal request response cycle, of getting "/events" and then checking the response is a redirect returns an error that there is no response...</p>