From: "Eustáquio Rangel" Date: 2006-05-04T02:45:10+09:00 Subject: Re: Unit test setup Hi. > You don't need it and you don't want it. You can't be so sure about that all over the time. ;-) > Ruby doesn't have deconstructors at all. Yes, I know, I was trying to figure out some global method like the "destroy" method on the unit testing class. I mean, a global "destroy" like the global "setup". Not really C++ destroy stuff. > The easiest way to achieve a "global" test setup is by invoking > explicitly the test runner: That worked, thanks! Btw, it was the only way I thought to test the socket operations. Even if most tests are not on the correct sequence (I just need step 2 below are the first one - ok, it's requirement), I can make things like: 1 - Connect on the socket (the "global" setup). 2 - Send a hello and get an id. 3 - List all the other users there. 4 - Send a ping to make sure we're still there. 5 - Send a quit, goodbye. 6 - Close the socket. All the operations from 3 and below needs the id from 2, where the server authorize the client with a password and return its id. So if I open/close the socket on every test I lost the authorization and the id. I use the asserts to test if the authentication worked and returned a valid id, if returns the user list, and so on. But I accept suggestions for improvements. :-) Thanks! -- Posted via http://www.ruby-forum.com/.