[Rt-commit] rt branch, 4.0/on-forward-conditions, updated. rt-4.0.1-200-g6d752dd

Jason May jasonmay at bestpractical.com
Tue Aug 23 12:06:45 EDT 2011


The branch, 4.0/on-forward-conditions has been updated
       via  6d752ddac80a8350a6f68cc580de39ab575235db (commit)
      from  0f452545bf318d1264a5a6eab679e4af01f0126f (commit)

Summary of changes:
 t/web/scrips.t |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 6d752ddac80a8350a6f68cc580de39ab575235db
Author: Jason May <jasonmay at bestpractical.com>
Date:   Tue Aug 23 12:03:44 2011 -0400

    Don't hard-code condition IDs since they may change in the future

diff --git a/t/web/scrips.t b/t/web/scrips.t
index 4d141bc..fae47d2 100644
--- a/t/web/scrips.t
+++ b/t/web/scrips.t
@@ -23,17 +23,28 @@ sub prepare_code_with_value {
     return
         '$self->TicketObj->SetSubject(' .
         '$self->TicketObj->Subject . ' .
-        $value .
+        '"|" . ' . $value .
         ')';
 }
 
 {
     # preserve order for checking the subject string later
-    my @values_for_actions = (
-        [4 => '"Fwd"'],
-        [5 => '"FwdTicket"'],
-        [6 => '"FwdTransaction"'],
-    );
+    my @values_for_actions;
+
+    my $conds = RT::ScripConditions->new(RT->SystemUser);
+    for ('On Forward', 'On Forward Ticket', 'On Forward Transaction') {
+        $conds->Limit(
+            FIELD           => 'name',
+            VALUE           => $_,
+            ENTRYAGGREGATOR => 'OR',
+        );
+    }
+
+    while (my $rec = $conds->Next) {
+        push @values_for_actions, [$rec->Id, '"' . $rec->Name . '"'];
+    }
+
+    @values_for_actions = sort { $a->[0] cmp $b->[0] } @values_for_actions;
 
     foreach my $data (@values_for_actions) {
         my ($condition, $prepare_code_value) = @$data;
@@ -72,7 +83,7 @@ sub prepare_code_with_value {
         button => 'ForwardAndReturn'
     );
 
-    $m->text_contains("#${ticket}: subjectFwdFwdTicket");
+    $m->text_contains("#${ticket}: subject|On Forward|On Forward Ticket");
 
     diag "Forward Transaction" if $ENV{TEST_VERBOSE};
     # get the first transaction on the ticket
@@ -88,7 +99,7 @@ sub prepare_code_with_value {
         button => 'ForwardAndReturn'
     );
 
-    $m->text_contains("#${ticket}: subjectFwdFwdTicketFwdFwdTransaction");
+    $m->text_contains("#${ticket}: subject|On Forward|On Forward Ticket|On Forward|On Forward Transaction");
 
     RT::Test->clean_caught_mails;
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list