[Catalyst-commits] r11050 - in trunk/Catalyst-Plugin-ConfigLoader: . lib/Catalyst/Plugin t

dandv at dev.catalyst.perl.org dandv at dev.catalyst.perl.org
Fri Aug 7 11:06:58 GMT 2009


Author: dandv
Date: 2009-08-07 11:06:47 +0000 (Fri, 07 Aug 2009)
New Revision: 11050

Added:
   trunk/Catalyst-Plugin-ConfigLoader/t/30-catalyst_test_suffix.t
Modified:
   trunk/Catalyst-Plugin-ConfigLoader/Changes
   trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm
Log:
Test case and patch for RT #47937 - MYAPP_CONFIG_LOCAL_SUFFIX ignored w/ Catalyst::Test



Modified: trunk/Catalyst-Plugin-ConfigLoader/Changes
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/Changes	2009-08-07 00:57:21 UTC (rev 11049)
+++ trunk/Catalyst-Plugin-ConfigLoader/Changes	2009-08-07 11:06:47 UTC (rev 11050)
@@ -1,5 +1,8 @@
 Revision history for Perl extension Catalyst::Plugin::ConfigLoader.
 
+    - Test case for RT #47937 - MYAPP_CONFIG_LOCAL_SUFFIX ignored w/
+      Catalyst::Test (Dan Dascalescu) and patch (prestemon)
+
 0.24  Mon Jun 29 2009
     - Add an __ENV(foo)__ macro + tests (Stuart Watt)
     - Document CATALYST_CONFIG_LOCAL_SUFFIX and MYAPP_LOCAL_CONFIG_SUFFIX

Modified: trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm	2009-08-07 00:57:21 UTC (rev 11049)
+++ trunk/Catalyst-Plugin-ConfigLoader/lib/Catalyst/Plugin/ConfigLoader.pm	2009-08-07 11:06:47 UTC (rev 11050)
@@ -17,14 +17,14 @@
 =head1 SYNOPSIS
 
     package MyApp;
-    
+
     # ConfigLoader should be first in your list so
     # other plugins can get the config information
     use Catalyst qw( ConfigLoader ... );
-    
+
     # by default myapp.* will be loaded
     # you can specify a file if you'd like
-    __PACKAGE__->config( 'Plugin::ConfigLoader' => { file => 'config.yaml' } );    
+    __PACKAGE__->config( 'Plugin::ConfigLoader' => { file => 'config.yaml' } );
 
   In the file, assuming it's in YAML format:
 
@@ -63,7 +63,7 @@
 
 This method is automatically called by Catalyst's setup routine. It will
 attempt to use each plugin and, once a file has been successfully
-loaded, set the C<config()> section. 
+loaded, set the C<config()> section.
 
 =cut
 
@@ -222,7 +222,7 @@
     my $c = shift;
 
     my $appname = ref $c || $c;
-    my $suffix = Catalyst::Utils::env_value( $c, 'CONFIG_LOCAL_SUFFIX' )
+    my $suffix = Catalyst::Utils::env_value( $appname, 'CONFIG_LOCAL_SUFFIX' )
         || $c->config->{ 'Plugin::ConfigLoader' }->{ config_local_suffix }
         || 'local';
 
@@ -307,15 +307,15 @@
     my $subs = $c->config->{ 'Plugin::ConfigLoader' }->{ substitutions }
         || {};
     $subs->{ HOME }    ||= sub { shift->path_to( '' ); };
-    $subs->{ ENV }    ||= 
-        sub { 
-            my ( $c, $v ) = @_; 
+    $subs->{ ENV }    ||=
+        sub {
+            my ( $c, $v ) = @_;
             if (! defined($ENV{$v})) {
                 Catalyst::Exception->throw( message =>
                     "Missing environment variable: $v" );
                 return "";
             } else {
-                return $ENV{ $v }; 
+                return $ENV{ $v };
             }
         };
     $subs->{ path_to } ||= sub { shift->path_to( @_ ); };
@@ -346,7 +346,7 @@
 
 =back
 
-Work to this module has been generously sponsored by: 
+Work to this module has been generously sponsored by:
 
 =over 4
 
@@ -359,11 +359,11 @@
 Copyright 2006-2009 by Brian Cassidy
 
 This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself. 
+it under the same terms as Perl itself.
 
 =head1 SEE ALSO
 
-=over 4 
+=over 4
 
 =item * L<Catalyst>
 

Added: trunk/Catalyst-Plugin-ConfigLoader/t/30-catalyst_test_suffix.t
===================================================================
--- trunk/Catalyst-Plugin-ConfigLoader/t/30-catalyst_test_suffix.t	                        (rev 0)
+++ trunk/Catalyst-Plugin-ConfigLoader/t/30-catalyst_test_suffix.t	2009-08-07 11:06:47 UTC (rev 11050)
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 2;
+
+BEGIN {
+    $ENV{TESTAPP_CONFIG_LOCAL_SUFFIX} = 'test';
+}
+use Catalyst::Test 'TestApp';
+
+ok my ($res, $c) = ctx_request('/'), 'context object';
+
+is $c->get_config_local_suffix, 'test', 'RT #47937';




More information about the Catalyst-commits mailing list