On 20.11.2007 03:43, weathercoach / gmail.com wrote: >> On second thought. Get rid of script_clean entirely. It is useless. >> Use Tempfile instead and you'll be happier. > > > Ryan. > The script_clean method is also used when an exception is raised not > just as the last line of the script, if that was the case I would > agree with your recomendation to remove it. Some of the tests I had > planned on creating would trigger an exception to make sure my error > handling is correct. Part of the error handling is cleaning up any > transient files and exiting immediatly to ensure that the script does > not continue running and do something unintended. This sounds as if you did not yet get the hang of exception handling. If an exception is so serious that the whole program cannot possibly proceed then don't catch the exception (or catch and rethrow another one). There are a lot mechanisms to ensure proper and robust cleanup, e.g. "ensure" clauses, END, at_exit, ObjectSpace.define_finalizer and on a higher level as Ryan pointed out: Tempfile, File.open with block ... > If a call to "exit" impacts the execution of the unit tests I'm > trying to understand if I should be using a different approach. Yes, IMHO you should use a different approach - but not only to testing but as well (and more important) to error handling. Please try to get rid of your shell mindset when doing Ruby development. Kind regards robert