[rspec-users] Testing Routing Constraint => redirect example.com to www.example.com

Shane Mingins elc at mingins.com
Mon Aug 1 22:29:28 EDT 2011

Hi All

With the following route

  constraints(:host => "example.com") do
    match "(*x)" => redirect { |params, request|
      URI.parse(request.url).tap { |x| x.host = "www.example.com" }.to_s

I am wondering how or where I would spec this?

Ideally I would like to be able to write a routing spec, something like:

get("http://example.com").should route_to(:controller => "home", :action =>
"index", :host => "www.example.com")

Thanks in advance

Shane Mingins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110802/80902bf9/attachment.html>

More information about the rspec-users mailing list