[Rt-commit] r19728 - rtfm/trunk/t/lib/RT/FM

ruz at bestpractical.com ruz at bestpractical.com
Tue May 19 17:41:31 EDT 2009


Author: ruz
Date: Tue May 19 17:41:30 2009
New Revision: 19728

Modified:
   rtfm/trunk/t/lib/RT/FM/Test.pm

Log:
* refactor overridings of plugin's base path

Modified: rtfm/trunk/t/lib/RT/FM/Test.pm
==============================================================================
--- rtfm/trunk/t/lib/RT/FM/Test.pm	(original)
+++ rtfm/trunk/t/lib/RT/FM/Test.pm	Tue May 19 17:41:30 2009
@@ -36,13 +36,19 @@
 
     RT->Config->Set('Plugins',qw(RT::FM));
 
+    $class->set_plugin_base_path;
+}
+
+sub set_plugin_base_path {
     # we need to lie to RT and have it find RTFM's mason templates 
     # in the local directory
-    { no warnings 'redefine';
-      my $cwd = getcwd;
-      *RT::Plugin::_BasePath = sub { return $cwd };
-    }
-
+    no warnings 'redefine';
+    my $cwd = getcwd;
+    my $old_func = \&RT::Plugin::_BasePath;
+    *RT::Plugin::_BasePath = sub {
+        return $cwd if $_[0]->{name} eq 'RT::FM';
+        return $old_func->(@_);
+    };
 }
 
 1;


More information about the Rt-commit mailing list