From fb7b33b1a70b2dc839b83364308963a3132dd098 Mon Sep 17 00:00:00 2001 From: Will Leinweber Date: Sat, 21 Mar 2009 12:14:42 +0800 Subject: [PATCH] Specs now clean up after themselves by deleting the test databases Signed-off-by: Matt Aimonetti --- spec/spec_helper.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4e4b507..7e6800a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,4 +23,16 @@ def reset_test_db! db = cr.database(TESTDB) db.recreate! rescue nil db +end + +Spec::Runner.configure do |config| + config.before(:all) { reset_test_db! } + + config.after(:all) do + cr = TEST_SERVER + test_dbs = cr.databases.select { |db| db =~ /^#{TESTDB}/ } + test_dbs.each do |db| + cr.database(db).delete! rescue nil + end + end end \ No newline at end of file