[Rt-commit] r19011 - rt/3.999/branches/lorzy/t/lorzy

clkao at bestpractical.com clkao at bestpractical.com
Wed Apr 1 09:46:49 EDT 2009


Author: clkao
Date: Wed Apr  1 09:46:49 2009
New Revision: 19011

Modified:
   rt/3.999/branches/lorzy/t/lorzy/basic.t

Log:
update test to use hints as code are serialized now.

Modified: rt/3.999/branches/lorzy/t/lorzy/basic.t
==============================================================================
--- rt/3.999/branches/lorzy/t/lorzy/basic.t	(original)
+++ rt/3.999/branches/lorzy/t/lorzy/basic.t	Wed Apr  1 09:46:49 2009
@@ -1,4 +1,4 @@
-use Test::More tests => 7;
+use Test::More tests => 8;
 use RT::Test;
 
 use strict;
@@ -59,17 +59,19 @@
 ok($ret);
 
 use RT::Lorzy;
-# XXX: rework the test to use a context object
-my $action_is_run = 0;
 
+$YAML::Syck::UseCode = $YAML::UseCode = 1;
 my $rule = RT::Model::Rule->new( current_user => RT->system_user );
 $rule->create_from_factory(
     RT::Lorzy::RuleFactory->make_factory
             ( { condition => $is_open,
+                description => 'test action',
                 _stage => 'transaction_create',
-                action => sub { $action_is_run++ } } )
+                action => sub { $_[0]->{context}{hints}{run}++ } } )
 );
-warn $rule->id;
-$ticket->comment(content => 'lorzy lorzy in the code');
+my ($txn_id, $tmsg, $txn) = $ticket->comment(content => 'lorzy lorzy in the code');
+my ($this_rule) = grep { $_->description eq 'test action'} @{$txn->rules};
+
+ok($this_rule);
+is_deeply($this_rule->hints, { run => 1 });
 
-ok($action_is_run);


More information about the Rt-commit mailing list