[siesta-commit] siesta/t 10plugin_membersonly.t,1.10,1.11 15defer.t,1.3,1.4

[prev] [thread] [next] [lurker] [Date index for 2003/03/16]

From: clampr
Subject: [siesta-commit] siesta/t 10plugin_membersonly.t,1.10,1.11 15defer.t,1.3,1.4
Date: 15:33 on 16 Mar 2003
Update of /cvsroot/siesta/siesta/t
In directory sc8-pr-cvs1:/tmp/cvs-serv9132/t

Modified Files:
	10plugin_membersonly.t 15defer.t 
Log Message:
more defer hacking

Index: 10plugin_membersonly.t
===================================================================
RCS file: /cvsroot/siesta/siesta/t/10plugin_membersonly.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- 10plugin_membersonly.t	10 Oct 2002 12:58:49 -0000	1.10
+++ 10plugin_membersonly.t	16 Mar 2003 15:33:04 -0000	1.11
@@ -21,10 +21,13 @@
 my $message;
 my $plugin = Siesta::Plugin::MembersOnly->new;
 my $list   = Siesta::List->new('dealers');
-my $mail   =
-  Test::MockObject->new->mock( from => sub { 'dante@quick-stop' } )
+my $mail   = Test::MockObject
+  ->new
+  ->mock( from  => sub { 'dante@quick-stop' } )
   ->mock( reply => sub { $message = join '', @_ } )
-  ->mock( list => sub { $list } )->mock( to => sub { 'foo@xxx.xxx' } );
+  ->mock( list  => sub { $list } )
+  ->mock( defer => sub { 0 })
+  ->mock( to    => sub { 'foo@xxx.xxx' } );
 
 ok( $plugin->process($mail), "rejected dante" );
 like( $message, qr{Non-member posting is disabled}, "said why" );

Index: 15defer.t
===================================================================
RCS file: /cvsroot/siesta/siesta/t/15defer.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- 15defer.t	16 Mar 2003 02:23:47 -0000	1.3
+++ 15defer.t	16 Mar 2003 15:33:04 -0000	1.4
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 7;
+use Test::More tests => 11;
 use Siesta;
 use Siesta::Config;
 use File::Find::Rule;
@@ -15,21 +15,31 @@
 ok( $list, "got a list" );
 
 my $message = Siesta::Message->new(\*DATA);
-ok( $message, "made a message" );
+ok( $message, "made a message from DATA" );
 
-is( $message->subject, "yoohoo" );
+is( $message->subject, "yoohoo", "  on which the subject is correct" );
 $message->list($list);
 
 my @deferred = $list->deferred;
 is( scalar @deferred, 0, "we have no deferred messages" );
 
-$message->defer( for => 'the hell of it' );
+ok( $message->defer( for => 'the hell of it' ), "deferred a message" );
 
 @deferred = $list->deferred;
 is( scalar @deferred, 1, "we have 1 deferred message" );
 
-is( $deferred[0]->subject, "yoohoo", "deferred message has correct subject" );
-is( $deferred[0]->deferred_for, "the hell of it", "deferred message has correct deferred reason" );
+my $def = shift @deferred;
+
+is( $def->subject, "yoohoo", "deferred message has correct subject" );
+is( $def->deferred_for, "the hell of it", "deferred message has correct deferred reason" );
+ok( $def->deferred_file, "it knows what file it came from" );
+ok( -e $def->deferred_file, " and it exists" );
+
+unlink $def->deferred_file;
+
+@deferred = $list->deferred;
+is( scalar @deferred, 0, "we have 0 deferred messages again" );
+
 
 __DATA__
 From: jay@xxxxxxxx.xxxxxxxxxx



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