You can test it with a controller spec as Brian mentioned by crafting a bad request to the controller.