[Jifty-commit] r3154 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Apr 18 11:40:14 EDT 2007


Author: evdb
Date: Wed Apr 18 11:40:13 2007
New Revision: 3154

Modified:
   jifty/trunk/lib/Jifty/Test.pm

Log:
Created a method that can be over-ridden for custom test database setup


Modified: jifty/trunk/lib/Jifty/Test.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Test.pm	(original)
+++ jifty/trunk/lib/Jifty/Test.pm	Wed Apr 18 11:40:13 2007
@@ -187,16 +187,30 @@
     # Mason's disk caching sometimes causes false tests
     rmtree([ File::Spec->canonpath("$root/var/mason") ], 0, 1);
 
+$class->setup_test_database;
+
+    $class->setup_mailbox;
+}
+
+=head2 setup_test_database
+
+Create the test database. This can be overloaded if you do your databases in a
+different way.
+
+=cut
+
+sub setup_test_database {
+    my $class = shift;
+
     Jifty->new( no_handle => 1 );
 
     my $schema = Jifty::Script::Schema->new;
-    $schema->{drop_database} =
-      $schema->{create_database} =
-        $schema->{create_all_tables} = 1;
+    $schema->{drop_database}     = 1;
+    $schema->{create_database}   = 1;
+    $schema->{create_all_tables} = 1;
     $schema->run;
 
     Jifty->new();
-    $class->setup_mailbox;
 }
 
 =head2 test_config


More information about the Jifty-commit mailing list