allow custom macros or overriding of config_substitutions() sub.
[catagits/Catalyst-Plugin-ConfigLoader.git] / t / 20-mock_load.t
CommitLineData
a7afecf7 1package MockApp;
2
d392c48d 3use Test::More tests => 9;
a7afecf7 4
5use Cwd;
6$ENV{ CATALYST_HOME } = cwd . '/t/mockapp';
7
8use_ok( 'Catalyst', qw( ConfigLoader ) );
9
d392c48d 10__PACKAGE__->config->{ substitutions } = {
11 foo => sub { shift; join('-', @_); }
12};
13
a7afecf7 14__PACKAGE__->setup;
15
a7afecf7 16ok( __PACKAGE__->config );
17is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' );
18is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' );
19is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );
20is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' );
21is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' );
d392c48d 22is( __PACKAGE__->config->{ 'foo_sub' }, 'x-y' );
23is( __PACKAGE__->config->{ 'literal_macro' }, '__DATA__' );