[Bps-public-commit] r17568 - in RTx-WorkflowBuilder: t

clkao at bestpractical.com clkao at bestpractical.com
Tue Jan 6 05:38:38 EST 2009


Author: clkao
Date: Tue Jan  6 05:38:37 2009
New Revision: 17568

Modified:
   RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm
   RTx-WorkflowBuilder/t/basic.t

Log:
update tests as we now automatically open the leave approval
and send notification to owner once all approvals are passed.


Modified: RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm
==============================================================================
--- RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm	(original)
+++ RTx-WorkflowBuilder/lib/RTx/WorkflowBuilder.pm	Tue Jan  6 05:38:37 2009
@@ -70,7 +70,8 @@
         $attributes->{Cc} =
             join(',', grep { $_ ne $self->owner } @{$attributes->{Cc}});
     }
-    $attributes->{SquelchMailTo} = $attributes->{Cc};
+    $attributes->{SquelchMailTo} = $attributes->{Cc}
+        if $attributes->{Cc};
 
     for (values %$attributes) {
         s/\$Approving/\$Tickets{TOP}/g;

Modified: RTx-WorkflowBuilder/t/basic.t
==============================================================================
--- RTx-WorkflowBuilder/t/basic.t	(original)
+++ RTx-WorkflowBuilder/t/basic.t	Tue Jan  6 05:38:37 2009
@@ -87,29 +87,20 @@
                    Owner => "root", Requestor => 'minion',
                    'CustomField-'.$dep_cf->id => 'IT',
                    Queue => $q->Id);
-} { from => qr/PO via RT/,
+} { #from => qr/RT/,
+    to => 'roy at company.com',
+    subject => qr/New Pending Approval/,
+    body => qr/pending your approval/,
+},{ from => qr/PO via RT/,
     to => 'minion at company.com',
     subject => qr/answering machines/,
-    body => qr/automatically generated in response/
+    body => qr/automatically generated in response/,
 };
 
 ok ($tid,$tmsg);
 
 is ($t->ReferredToBy->Count,3, "referred to by the three tickets");
 
-# open the approval tickets that are ready for approval
-mail_ok {
-    for my $ticket ($t->AllDependsOn) {
-        next if $ticket->Type ne 'approval' && $ticket->Status ne 'new';
-        next if $ticket->HasUnresolvedDependencies( Type => 'approval' );
-        $ticket->SetStatus('open');
-    }
-} { from => qr/RT System/,
-    to => 'roy at company.com',
-    subject => qr/New Pending Approval: Manager Approval/,
-    body => qr/pending your approval/
-};
-
 my $deps = $t->DependsOn;
 is ($deps->Count, 1, "The ticket we created depends on one other ticket");
 my $dependson_ceo= $deps->First->TargetObj;
@@ -187,6 +178,10 @@
     to => 'minion at company.com',
     subject => qr/Ticket Approved:/,
     body => qr/approved by CEO/
+},{ from => qr/CEO via RT/,
+    to => 'root at localhost',
+    subject => qr/Ticket Approved:/,
+    body => qr/The ticket has been approved/
 };
 
 is_deeply([ map { $_->Status } $t, $dependson_roy, $dependson_cfo, $dependson_ceo ],



More information about the Bps-public-commit mailing list