title: Rails Host Route Rspec Test
body: <p>Is it possible to write an RSpec routing test for the following route derived from <a href="http://8raystech.com/2011/02/08/redirecting-www-url-requests-to-non-www-url-in-rails-3" rel="nofollow">this blog</a>? </p>
  
  <pre><code>constraints(:host =&gt; "example.com") do
    match "(*x)" =&gt; redirect { |params, request|
      URI.parse(request.url).tap { |x| x.host = "www.example.com" }.to_s
    }
  end
  </code></pre>