From: Robert Klemme Date: 2004-12-29T18:01:46+09:00 Subject: Re: unit testing of methods which do Kernel#exit "Nobuyoshi Nakada" schrieb im Newsbeitrag news:200412290040.iBT0e5jo004676@sharui.nakada.niregi.kanuma.tochigi.jp... > Hi, > > At Wed, 29 Dec 2004 07:56:16 +0900, > Michal wrote in [ruby-talk:124685]: > > I ran into a problem -- how to unit test methods that have > > Kernel#exit call in case of troubles (fatal errors). > > > > I found solution (imho) better than changing behaviour > > of Kernel.exit -- I simply raise SystemExit, exitcode ... > > Kernel.exit does it too, so you can catch "exit" by `rescue > SystemExit'. Apart from that I would not write tests that do exit the system. Usually tests fail with an exception - that should be enough. robert