Write at least a simple functional test for each of your actions
If you’re like me, you focus on writing unit tests more than functional tests. Most of the key business logic should be in your models anyway, and it’s easier to test at that level.
Nevertheless, it’s a good idea to at least write a basic functional test for each action to make sure the action at least runs through without any exceptions.
If you run autotest (which is a great tool), or at least run rake:test before any commits, these simple tests can catch boneheaded mistakes like one I made today.
I modified a controller and added an instance varible, which I then referenced in a partial. Everything worked fine and it looked good in the browser, so I committed it.
Unfortunately, I stupidly forgot that the partial was used in another context, and that action promptly broke, because I didn’t create the instance variable there. As it turns out, the proper fix was to move my instance variable out of the partial and into the main template.
A simple functional test on each action would have revealed my mistake right away.