Writing test code for ApplicationController
Did you ever try to write functional test code for ApplicationController? You might have faced such situations where you needed to test some methods of your application controller. Well when you will start testing a method of your ApplicationController, you would probably have a "aha" moment - "If I had a view file for that method!!". Yes the problem is template missing error. Usually the methods in ApplicationController dont have a corresponding template. Therefore, sending test request to those methods will definitely raise an ActionView::MissingTemplate error. So what you need to do is just tell the ApplicationController - "Please dont raise any template missing exception. I am testing your methods :)". But how will you tell this? Simple, just override the rescue_action method and raise nothing!! Just like the following: class ApplicationController def rescue_action(e) end end Yes, this will keep all the exceptions away from you. Howev...