[Rt-commit] r3129 - in RT-Action-ExtractSubjectTag: . t

kevinr at bestpractical.com kevinr at bestpractical.com
Thu Jun 9 20:30:01 EDT 2005


Author: kevinr
Date: Thu Jun  9 20:30:01 2005
New Revision: 3129

Modified:
   RT-Action-ExtractSubjectTag/   (props changed)
   RT-Action-ExtractSubjectTag/t/01extract_tags.t
   RT-Action-ExtractSubjectTag/t/02custom_tags.t
   RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE
Log:
 r4148 at SAD-GIRL-IN-SNOW:  kevinr | 2005-06-09 20:29:52 -0400
 * Cleaned up the tests and fixed the issue with the local RT tag.


Modified: RT-Action-ExtractSubjectTag/t/01extract_tags.t
==============================================================================
--- RT-Action-ExtractSubjectTag/t/01extract_tags.t	(original)
+++ RT-Action-ExtractSubjectTag/t/01extract_tags.t	Thu Jun  9 20:30:01 2005
@@ -1,23 +1,16 @@
 #!/sw/bin/perl5.8.6
 
 use strict;
-use Test::More qw/no_plan/;
-#use Test::More tests => 3;
+#use Test::More qw/no_plan/;
+use Test::More tests => 25;
 use RT;
 RT::LoadConfig();
 RT::Init;
 use RT::EmailParser;
-use RT::Tickets;
 use RT::Action::SendEmail;
 
-my @_outgoing_messages;
-my @scrips_fired;
-
-# much of the top of this file is blatantly stolen from '04send_email.t' in
-# the main RT regression suite.
-
 # make sure the module is installed
-BEGIN { use_ok('RT::Action::ExtractSubjectTag'); }
+use_ok('RT::Action::ExtractSubjectTag');
 
 # no idea if this test is useful in this context or not, but it's a nice one
 # to start with since it succeeds :)
@@ -113,16 +106,19 @@
 ok($ticket->Subject =~ /\Q[bar.example #24]\E/, "Second unique tag was added to ticket's subject");
 
 # create a new e-mail with the local RT instance's tag
-$email =~ s/\Q[bar.example #24]\E/[example.com #24]/;
+$email =~ s/\Q[bar.example #24]\E/[$RT::rtname #24]/;
 ($id, $message) = $parser->SmartParseMIMEEntityFromScalar( Message => $email, 
   Decode => 1 );
 ok($parser->Entity, "Parser returned a MIME entity");
 ok($parser->Entity->head, "Entity had a header");
 
+#$RT::Action::ExtractSubjectTag::ExtractSubjectTagNoMatch = qr/\[\Q$RT::rtname\E #\d+\]/;
+#$RT::EmailSubjectTagRegex = $RT::rtname;
+
 # check to make sure the scrip will *NOT* add that tag to the existing ticket
 ($id, $message, $transaction_obj) = $ticket->Correspond(MIMEObj=>$parser->Entity);
 ok($id, "conduct transaction? $message");
-ok($ticket->Subject !~ /\Q[example.com #24]\E/, "The local instance's tag was not added to ticket's subject");
+ok($ticket->Subject !~ /\Q[$RT::rtname #24]\E/, "The local instance's tag was not added to ticket's subject");
 
 ### test extraction of multiple tags from the same e-mail subject line ###
 
@@ -167,5 +163,3 @@
 );
 
 1;
-
-

Modified: RT-Action-ExtractSubjectTag/t/02custom_tags.t
==============================================================================
--- RT-Action-ExtractSubjectTag/t/02custom_tags.t	(original)
+++ RT-Action-ExtractSubjectTag/t/02custom_tags.t	Thu Jun  9 20:30:01 2005
@@ -5,20 +5,11 @@
 #use Test::More tests => 3;
 use RT;
 RT::LoadConfig();
-RT::Init;
+RT::Init();
 use RT::EmailParser;
-use RT::Tickets;
-use RT::Action::SendEmail;
-use RT::Action::ExtractSubjectTag;
-
-my @_outgoing_messages;
-my @scrips_fired;
-
-# much of the top of this file is blatantly stolen from '04send_email.t' in
-# the main RT regression suite.
 
 # make sure the module is installed
-BEGIN { use_ok('RT::Action::ExtractSubjectTag'); }
+use_ok('RT::Action::ExtractSubjectTag');
 
 # no idea if this test is useful in this context or not, but it's a nice one
 # to start with since it succeeds :)
@@ -126,7 +117,7 @@
 ($id, $message) = $parser->SmartParseMIMEEntityFromScalar( Message => $email, 
   Decode => 1 );
 ok($parser->Entity, "Parser returned a MIME entity");
-ok($parser->Entity->head, "Entity had a header:\n@{[$parser->Head->stringify]}");
+ok($parser->Entity->head, "Entity had a header");
 
 # make sure the second excluded tag isn't added
 ($id, $message, $transaction_obj) = $ticket->Correspond(MIMEObj => $parser->Entity);
@@ -149,7 +140,7 @@
 ($id, $message) = $parser->SmartParseMIMEEntityFromScalar( Message => $email, 
   Decode => 1 );
 ok($parser->Entity, "Parser returned a MIME entity");
-ok($parser->Entity->head, "Entity had a header:\n@{[$parser->Head->stringify]}");
+ok($parser->Entity->head, "Entity had a header");
 
 # make sure that included tags can still be added
 ($id, $message, $transaction_obj) = $ticket->Correspond(MIMEObj => $parser->Entity);

Modified: RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE
==============================================================================
--- RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE	(original)
+++ RT-Action-ExtractSubjectTag/t/TESTS-TO-WRITE	Thu Jun  9 20:30:01 2005
@@ -1,5 +1,5 @@
 * can we extract basic (RT) subject tags?
-- can we extract non RT subject tags?
-- can we extract multiple tags from the same subject line?
-- can we have a complex NoMatch directive?
+* can we extract non RT subject tags?
+* can we extract multiple tags from the same subject line?
+* can we have a complex NoMatch directive?
 * is the ScripAction added properly?


More information about the Rt-commit mailing list