trailing whitespace
[catagits/Catalyst-Plugin-ConfigLoader.git] / t / 21-mock_load_env.t
CommitLineData
4f63af80 1package MockApp;
2
24e563f5 3use Test::More tests => 10;
4f63af80 4use Cwd;
64443e1a 5
6# Remove all relevant env variables to avoid accidental fail
7foreach my $name ( grep { m{^(CATALYST|MOCKAPP)} } keys %ENV ) {
8 delete $ENV{ $name };
545e8098 9}
64443e1a 10
587d381b 11$ENV{ CATALYST_HOME } = cwd . '/t/mockapp';
4f63af80 12$ENV{ MOCKAPP_CONFIG } = $ENV{ CATALYST_HOME } . '/mockapp.pl';
13
14use_ok( 'Catalyst', qw( ConfigLoader ) );
15
16__PACKAGE__->config->{ 'Plugin::ConfigLoader' }->{ substitutions } = {
587d381b 17 foo => sub { shift; join( '-', @_ ); }
4f63af80 18};
19
20__PACKAGE__->setup;
21
22ok( __PACKAGE__->config );
23is( __PACKAGE__->config->{ 'Controller::Foo' }->{ foo }, 'bar' );
24is( __PACKAGE__->config->{ 'Controller::Foo' }->{ new }, 'key' );
587d381b 25is( __PACKAGE__->config->{ 'Model::Baz' }->{ qux }, 'xyzzy' );
26is( __PACKAGE__->config->{ 'Model::Baz' }->{ another }, 'new key' );
27is( __PACKAGE__->config->{ 'view' }, 'View::TT::New' );
28is( __PACKAGE__->config->{ 'foo_sub' }, 'x-y' );
29is( __PACKAGE__->config->{ 'literal_macro' }, '__DATA__' );
24e563f5 30is( __PACKAGE__->config->{ 'environment_macro' }, $ENV{ CATALYST_HOME }.'/mockapp.pl' );