[rspec-users] Speccing a redirect in routes

David Chelimsky dchelimsky at gmail.com
Mon Aug 8 20:02:04 EDT 2011


On Aug 8, 2011, at 6:00 PM, Matt Wynne wrote:

> Hi,
> 
> I expected to be able to do something like this in a routing spec:
> 
> { :get => '/legacy/route' }.should redirect_to('/shiny/new/route')

Routes resolve to paths to controller actions, they don't do any http redirection.

> However there doesn't appear to be a redirect_to matcher, and digging deeper I can't even see an underlying Rails assertion method that will assert for redirect routing configuration. Did I miss it?
> 
> Do I need to spec this with a request spec instead?

Or a controller spec. Either way, it's the controller that's redirecting

Cheers,
David





More information about the rspec-users mailing list