fix for get_config_path also v0.25
Brian Cassidy [Fri, 7 Aug 2009 11:44:24 +0000 (11:44 +0000)]
Changes
lib/Catalyst/Plugin/ConfigLoader.pm
t/22-suffix_env.t [new file with mode: 0644]
t/23-path_env.t [new file with mode: 0644]
t/30-catalyst_test_suffix.t [deleted file]

diff --git a/Changes b/Changes
index 66a3d17..f869469 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,8 +1,8 @@
 Revision history for Perl extension Catalyst::Plugin::ConfigLoader.
 
 0.25  Fri Aug 07 2009
-    - Test case for RT #47937 - MYAPP_CONFIG_LOCAL_SUFFIX ignored w/
-      Catalyst::Test (Dan Dascalescu) and patch (prestemon)
+    - Fix get_config_local_suffix and get_config_path when finding values 
+      from ENV vars (RT #47937)
 
 0.24  Mon Jun 29 2009
     - Add an __ENV(foo)__ macro + tests (Stuart Watt)
index 5edbad1..e9d5d80 100644 (file)
@@ -179,7 +179,7 @@ sub get_config_path {
 
     my $appname = ref $c || $c;
     my $prefix  = Catalyst::Utils::appprefix( $appname );
-    my $path    = Catalyst::Utils::env_value( $c, 'CONFIG' )
+    my $path    = Catalyst::Utils::env_value( $appname, 'CONFIG' )
         || $c->config->{ 'Plugin::ConfigLoader' }->{ file }
         || $c->path_to( $prefix );
 
diff --git a/t/22-suffix_env.t b/t/22-suffix_env.t
new file mode 100644 (file)
index 0000000..3d47bd6
--- /dev/null
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 3;
+
+BEGIN {
+    $ENV{ TESTAPP_CONFIG_LOCAL_SUFFIX } = 'test';
+    use_ok 'Catalyst::Test', 'TestApp';
+}
+
+ok my ( $res, $c ) = ctx_request( '/' ), 'context object';
+
+is $c->get_config_local_suffix, 'test', 'suffix is "test"';
diff --git a/t/23-path_env.t b/t/23-path_env.t
new file mode 100644 (file)
index 0000000..8c4b6ed
--- /dev/null
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 3;
+
+BEGIN {
+    $ENV{ TESTAPP_CONFIG } = 'test.perl';
+    use_ok 'Catalyst::Test', 'TestApp';
+}
+
+ok my ( $res, $c ) = ctx_request( '/' ), 'context object';
+
+is_deeply [ $c->get_config_path ], [ qw( test.perl perl ) ], 'path is "test.perl"';
diff --git a/t/30-catalyst_test_suffix.t b/t/30-catalyst_test_suffix.t
deleted file mode 100644 (file)
index 02c9bd4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-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';