Rails has made it easy to generate JSON responses to requests, which should make life easier for any client developer (iOS, Android, Backbone, what have you). Fortunately, this includes error responses, which Rails will generate automatically (with a 422 response code) when model validation fails.
When you’re testing a Rails controller, as when testing anything, you want to verify that your controller exhibits the desired behavior given certain conditions. Rails controller tests make this somewhat difficult by not handling exceptions as the production controller infrastructure would. You can rectify this situation with only a few lines of code.