Hacker News new | past | comments | ask | show | jobs | submit login

Totally agree, that's why you need good MVC separation and you test those layers separately.

The models testing is obvious. What you're referring to there is controller testing. In Rails/Rspec, the way you do that is by mocking/stubbing the models (so you're only testing the controller logic). Then you pass in the parameters that would come in from the web, and check that the controller code (which should be fairly straightforward) behaves appropriately.

This article explains this approach quite clearly: http://www.patmaddox.com/blog/2007/9/15/easy-controller-test...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: