[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-188-g7233d34

Shawn Moore sartak at bestpractical.com
Wed Jul 21 00:10:01 EDT 2010


The branch, new-style-templates has been updated
       via  7233d347093527c0cd265b7ac30bc2854b4962b0 (commit)
      from  a020779c0e90887f300f2a696ca79cd699f6cd35 (commit)

Summary of changes:
 t/api/template-simple.t |   50 +++++++++++++++++++++-------------------------
 1 files changed, 23 insertions(+), 27 deletions(-)

- Log -----------------------------------------------------------------
commit 7233d347093527c0cd265b7ac30bc2854b4962b0
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Jul 21 00:11:35 2010 -0400

    Refactor the template tests to be a little less repetitive still

diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index 65f1ba9..d90bbb8 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -11,44 +11,27 @@ my ($id, $msg) = $ticket->Create(
 );
 ok($id, "Created ticket");
 
-TemplateTest(
-    Type    => "Full",
-    Content => "\ntest",
-    Output  => "test",
-);
-
-TemplateTest(
-    Type    => "Full",
-    Content => "\ntest { 5 * 5 }",
-    Output  => "test 25",
-);
-
-TemplateTest(
-    Type    => "Full",
-    Content => "\ntest { \$Requestor }",
-    Output  => "test dom\@example.com",
-);
 
 TemplateTest(
-    Type    => "Simple",
-    Content => "\ntest",
-    Output  => "test",
+    Content      => "\ntest",
+    FullOutput   => "test",
+    SimpleOutput => "test",
 );
 
 TemplateTest(
-    Type    => "Simple",
-    Content => "\ntest { 5 * 5 }",
-    Output  => "test { 5 * 5 }",
+    Content      => "\ntest { 5 * 5 }",
+    FullOutput   => "test 25",
+    SimpleOutput => "test { 5 * 5 }",
 );
 
 TemplateTest(
-    Type    => "Simple",
-    Content => "\ntest { \$Requestor }",
-    Output  => "test dom\@example.com",
+    Content      => "\ntest { \$Requestor }",
+    FullOutput   => "test dom\@example.com",
+    SimpleOutput => "test dom\@example.com",
 );
 
 my $counter = 0;
-sub TemplateTest {
+sub IndividualTemplateTest {
     local $Test::Builder::Level = $Test::Builder::Level + 1;
 
     my %args = (
@@ -77,5 +60,18 @@ sub TemplateTest {
     is($t->MIMEObj->stringify_body, $args{Output}, "template's output");
 }
 
+sub TemplateTest {
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    my %args = @_;
+
+    for my $type ('Full', 'Simple') {
+        IndividualTemplateTest(
+            %args,
+            Type   => $type,
+            Output => $args{$type . 'Output'},
+        );
+    }
+}
+
 1;
 

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


More information about the Rt-commit mailing list