removed hash merging since it's a core behavior
Brian Cassidy [Wed, 31 May 2006 14:00:34 +0000 (14:00 +0000)]
Changes
lib/Catalyst/Plugin/ConfigLoader.pm
t/20-mock_load.t

diff --git a/Changes b/Changes
index fb52330..d88c2de 100644 (file)
--- a/Changes
+++ b/Changes
@@ -2,6 +2,7 @@ Revision history for Perl extension Catalyst::Plugin::ConfigLoader.
 \r
 0.09  Wed May 24 2006\r
     - ignore non-ref model/view/controller/component keys\r
+    - remove hash merging since it is now a core behavior\r
 \r
 0.08  Tue May 23 2006\r
     - added get_config_path() which extracts the path finding code\r
index 1788080..02a2734 100644 (file)
@@ -73,18 +73,6 @@ sub setup {
 \r
             _fix_syntax( $config );\r
             \r
-            # merge hashes 1 level down\r
-            for my $key ( keys %$config ) {\r
-                if( exists $c->config->{ $key } ) {\r
-                    my $isa_ref = ref $config->{ $key };\r
-\r
-                    next if !$isa_ref or $isa_ref ne 'HASH';\r
-\r
-                    my %temp = ( %{ $c->config->{ $key } }, %{ $config->{ $key } } );\r
-                    $config->{ $key } = \%temp;\r
-                }\r
-            }\r
-            \r
             $c->config( $config );\r
         }\r
     }\r
index f576f47..aa762a8 100644 (file)
@@ -1,43 +1,17 @@
-use Test::More tests => 6;\r
-\r
-my $app = MockApp->new;\r
-$app->setup;\r
-\r
-ok( $app->config );\r
-is( $app->config->{ 'Controller::Foo' }->{ foo }, 'bar' );\r
-is( $app->config->{ 'Controller::Foo' }->{ new }, 'key' );\r
-is( $app->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );\r
-is( $app->config->{ 'Model::Baz' }->{ another }, 'new key' );\r
-is( $app->config->{ 'view' }, 'View::TT::New' );\r
-\r
 package MockApp;\r
 \r
-use base qw( Catalyst::Plugin::ConfigLoader );\r
-use NEXT;\r
-use Catalyst::Utils;\r
-\r
-sub new {\r
-    return bless { }, shift;\r
-}\r
+use Test::More tests => 7;\r
 \r
-sub path_to {\r
-    return 't/mockapp';\r
-}\r
+use Cwd;\r
+$ENV{ CATALYST_HOME } = cwd . '/t/mockapp';\r
 \r
-sub debug {\r
-    0;\r
-}\r
+use_ok( 'Catalyst', qw( ConfigLoader ) );\r
 \r
-sub config {\r
-    my $self = shift;\r
-    $self->{ _config } = {} unless $self->{ _config };\r
-    if (@_) {\r
-        my $config = @_ > 1 ? {@_} : $_[0];\r
-        while ( my ( $key, $val ) = each %$config ) {\r
-            $self->{ _config }->{$key} = $val;\r
-        }\r
-    }\r
-    return $self->{ _config };\r
-}\r
+__PACKAGE__->setup;\r
 \r
-1;
\ No newline at end of file
+ok( __PACKAGE__->config );\r
+is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' );\r
+is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' );\r
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );\r
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' );\r
+is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' );\r