rev 1357 - in trunk/siesta: lib/Siesta t

[prev] [thread] [next] [lurker] [Date index for 2003/08/14]

From: richardc
Subject: rev 1357 - in trunk/siesta: lib/Siesta t
Date: 16:41 on 14 Aug 2003
Author: richardc
Date: 2003-08-14 16:41:05 +0100 (Thu, 14 Aug 2003)
New Revision: 1357

Modified:
   trunk/siesta/lib/Siesta/Member.pm
   trunk/siesta/t/09defer.t
Log:
cascading delete.  nuking a member takes deferred messages

Modified: trunk/siesta/lib/Siesta/Member.pm
===================================================================
--- trunk/siesta/lib/Siesta/Member.pm	2003-08-14 15:24:00 UTC (rev 1356)
+++ trunk/siesta/lib/Siesta/Member.pm	2003-08-14 15:41:05 UTC (rev 1357)
@@ -7,7 +7,9 @@
 __PACKAGE__->load_alias('email');
 __PACKAGE__->has_many( lists => [ 'Siesta::Subscription' => 'list' ] );
 __PACKAGE__->has_many( prefs => 'Siesta::Pref' );
+__PACKAGE__->has_many( deferred => 'Siesta::Deferred', 'who' );
 
+
 # fuck the users, fuck them up their stupid asses
 
 =head1 NAME

Modified: trunk/siesta/t/09defer.t
===================================================================
--- trunk/siesta/t/09defer.t	2003-08-14 15:24:00 UTC (rev 1356)
+++ trunk/siesta/t/09defer.t	2003-08-14 15:41:05 UTC (rev 1357)
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 19;
+use Test::More tests => 22;
 use lib qw(t/lib);
 use Siesta::Test;
 use Siesta;
@@ -88,6 +88,20 @@
 is( $Siesta::Send::Test::sent[-1]->header('reply-to'), 'spangly',
     "resumed message ran the right stages" );
 
+# check cascading delete on $user
+$message->defer(who => $user, why => 'test');
+ok( $handle, "froze something with somewhere to go" );
+
+@deferred = Siesta::Deferred->retrieve_all;
+is( scalar @deferred, 1, "we have 1 deferred message" );
+
+$user->delete;
+
+@deferred = Siesta::Deferred->retrieve_all;
+is( scalar @deferred, 0, "cascading delete" );
+
+
+
 __DATA__
 From: jay@xxxxxxxx.xxxxxxxxxx
 To: dealers@xxxxxxxx.xxxxxxxxxx

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52