Response.should be_success -- what does this prove?


#1

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.


#2

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 W.
http://blog.mattwynne.net
http://www.songkick.com


#3

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.