From: Rob Sanheim Date: 2006-08-06T04:28:54+09:00 Subject: Re: why can't I catch this exception? On 8/5/06, John Wilger wrote: > On 8/5/06, Rob Sanheim wrote: > > And I cannot get the exception to be caught in a test case, no matter > > what I do. For example, w/i a standard FooControllerTest: > > > > def test_bad_file_render_with_full_path_false > > assert_raises ActionController::MissingTemplate do > > get :bad_file_with_full_path_false > > end > > rescue Exception => e > > flunk("failed") > > end > > > > This just exits - no flunk msg, assert_raise doesn't catch, nothing. > > If it _is_ raising the exception, you won't reach that rescue -- > #assert_raises rescues the exception internally. Perhaps you meant to > use #assert_nothing_raised ? > > -- > Regards, > John Wilger John, I realize assert_raises _should_ rescue it, but then it should either pass or fail based on the class of the exception. My main issue is that the program just exits, with out success or failure for that test class. So its basically as if it was calling exit (which its not). Doing this will also show the same behavior: def test_bad_file_render_with_full_path_false get :bad_file_with_full_path_false end So my question is, what is happening inside TemplateError that it causes the whole process to do a hard exit? - Rob -- http://www.robsanheim.com http://www.seekingalpha.com http://www.ajaxian.com