Ryan Davis
9/8/2007 6:46:00 AM
On Sep 5, 2007, at 10:06 , Jeff - Burly Systems wrote:
> class BurndownTests < Test::Unit::TestCase
>
> @@db = nil
> @@done_with_db = false
>
> def setup
> db =DBI.connect(.......) if not @@db
> end
>
> def teardown
> db.disconnect if @@done_with_db
> end
This is what I use for such types of things:
$db = DBI...
at_exit { at_exit { $db.disconnect } } # guaranteed to run AFTER test/
unit is done
# ...stuff...