use explicit Plugin::ConfigLoader config section
[catagits/Catalyst-Plugin-ConfigLoader.git] / t / 20-mock_load.t
index aa762a8..b2dff39 100644 (file)
@@ -1,17 +1,23 @@
-package MockApp;\r
-\r
-use Test::More tests => 7;\r
-\r
-use Cwd;\r
-$ENV{ CATALYST_HOME } = cwd . '/t/mockapp';\r
-\r
-use_ok( 'Catalyst', qw( ConfigLoader ) );\r
-\r
-__PACKAGE__->setup;\r
-\r
-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
+package MockApp;
+
+use Test::More tests => 9;
+
+use Cwd;
+$ENV{ CATALYST_HOME } = cwd . '/t/mockapp';
+
+use_ok( 'Catalyst', qw( ConfigLoader ) );
+
+__PACKAGE__->config->{ 'Plugin::ConfigLoader' }->{ substitutions } = {
+    foo => sub { shift; join('-', @_); }
+};
+
+__PACKAGE__->setup;
+
+ok( __PACKAGE__->config );
+is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' );
+is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );
+is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' );
+is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' );
+is( __PACKAGE__->config->{ 'foo_sub' }, 'x-y' );
+is( __PACKAGE__->config->{ 'literal_macro' }, '__DATA__' );