Forum: RSpec response.should be_success -- what does this prove?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3548e5325ea8145cd6051ddadd5ae36c?d=identicon&s=25 Doug L. (biot023)
on 2009-06-05 14:44
(Received via mailing list)
Hi -- if my controller action already ensures that the correct template
is
being rendered, what use is speccing that it should also be successful?
I do it, but just because I saw someone else do it ages ago.
Is there a point?
Cheers,
   Doug.
636551d0dad1d57d2720fa6cd820a687?d=identicon&s=25 Matt W. (mattwynne)
on 2009-06-05 15:13
(Received via mailing list)
On 5 Jun 2009, at 13:36, doug livesey wrote:

> Hi -- if my controller action already ensures that the correct
> template is being rendered, what use is speccing that it should also
> be successful?
> I do it, but just because I saw someone else do it ages ago.
> Is there a point?

It checks that the response code indicates to the browser that the
request was 200 OK (as opposed to, say a 302 redirect, or a 404 not
found).

It's useful when you're doing TDD as it's the simplest thing to expect
a controller to do. If you break something it's also quite a nice
first-failure to have.

see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com
16f889cdde288ac019d94ada45aafdfd?d=identicon&s=25 Fernando P. (fernando)
on 2009-06-05 22:28
> It's useful when you're doing TDD as it's the simplest thing to expect
> a controller to do. If you break something it's also quite a nice
> first-failure to have.
Hmm, I'm not sure about that. If the view fails to render, then Rails
returns the error page,
i.e: response.should be_success is total crap.
This topic is locked and can not be replied to.