Re: Rspec test fails

Jussi Hirvi
Fri, 29 Mar 2013 07:32:36 -0000

On Thursday, March 28, 2013 4:06:09 PM UTC+2, Dihital
wrote:
>
> Redirect ends current request and starts a new one, so you are right that
> that''s the case (another action isn''t called nor its
template rendered).


That left me pondering, why does it matter that a new request is started.
Anyway, it seems that rspec tests can verify that a redirect to a given
path occurs, but there is no way to evaluate the contents of the resulting
page:

http://stackoverflow.com/questions/2865378/rspec-rails-how-to-follow-a-redirect

Maybe someone can verify that this is the case, or tell me otherwise?


> But shouldn''t you also test that admin user is still there
(wasn''t
> deleted) after redirect happened? You could have very easily have him
> deleted in your actual code and still redirect to root_path, making this
> spec pass incorrectly.
>

A good idea, yes, but that I left for the future.

- Jussi

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit