From: Brian Cassidy Date: Fri, 7 Aug 2009 11:44:24 +0000 (+0000) Subject: fix for get_config_path also X-Git-Tag: v0.25^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Ftags%2Fv0.25;p=catagits%2FCatalyst-Plugin-ConfigLoader.git fix for get_config_path also --- diff --git a/Changes b/Changes index 66a3d17..f869469 100644 --- 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) diff --git a/lib/Catalyst/Plugin/ConfigLoader.pm b/lib/Catalyst/Plugin/ConfigLoader.pm index 5edbad1..e9d5d80 100644 --- a/lib/Catalyst/Plugin/ConfigLoader.pm +++ b/lib/Catalyst/Plugin/ConfigLoader.pm @@ -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 index 0000000..3d47bd6 --- /dev/null +++ b/t/22-suffix_env.t @@ -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 index 0000000..8c4b6ed --- /dev/null +++ b/t/23-path_env.t @@ -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 index 02c9bd4..0000000 --- a/t/30-catalyst_test_suffix.t +++ /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';