How do I write a spec for a Rails route that does redirecting?

Posted by winstonyw on Stack Overflow See other posts from Stack Overflow or by winstonyw
Published on 2010-12-22T23:56:02Z Indexed on 2010/12/23 16:54 UTC
Read the original article Hit count: 210

Filed under:
|
|
|
|

I am using Omniauth in my Rails project, and I'll like to hide "/auth/facebook" behind a "/login" route.

In fact, I wrote a route:

match "/login", :to => redirect("/auth/facebook"), :as => :login

and this actually works, i.e. a link to login_path will redirect to /auth/facebook.

However, how can I write a (rspec) spec to test this route (specifically, the "redirect" option)?

Do note that /login is not an actual action nor method defined in application.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby