Matt Wynne
2009-Jun-05 13:11 UTC
[rspec-users] response.should be_success -- what does this prove?
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
Fernando Perez
2009-Jun-05 20:28 UTC
[rspec-users] response.should be_success -- what does this prove?
> 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. -- Posted via http://www.ruby-forum.com/.