[rspec-users] What is the best practices for controller specs?
guirec.corbel at gmail.com
Fri Jun 28 13:52:41 UTC 2013
I have a question about controllers specs.For now, in my specs, I have
something like this :
So, I think some people can find than I test the wrong thing. I test the
implementation of the controller and not a real specification.
In this article
http://kpumuk.info/ruby-on-rails/my-top-7-rspec-best-practices/, the author
say to not over mock. In this other article :
author is mocking everythings.
My own way is to test controllers, models, services, etc... in complete
isolation. Isolation is a good way to have fast tests and test only the
responsability of the object. I have acceptance tests which test the
integration. The bad part is than I have less flexibility and I can't
change a method or a class name without to break some tests.
So, my question is : What's your way and why?
Is it good to tests only if the controller render a template or redirect to
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users