Commit | Line | Data |
4b22d4c6 |
1 | package MockAppEnv; |
ffc0b0d8 |
2 | |
3 | use Test::More tests => 10; |
4 | use Cwd; |
5 | |
4b22d4c6 |
6 | { |
ffc0b0d8 |
7 | # Remove all relevant env variables to avoid accidental fail |
4b22d4c6 |
8 | foreach my $name ( grep { m{^(CATALYST|MOCKAPPENV)} } keys %ENV ) { |
9 | delete $ENV{ $name }; |
10 | } |
ffc0b0d8 |
11 | |
4b22d4c6 |
12 | $ENV{ CATALYST_HOME } = cwd . '/t/mockapp'; |
13 | $ENV{ MOCKAPPENV_CONFIG } = $ENV{ CATALYST_HOME } . '/mockapp.pl'; |
ffc0b0d8 |
14 | |
4b22d4c6 |
15 | use_ok( 'Catalyst' ); |
ffc0b0d8 |
16 | |
4b22d4c6 |
17 | __PACKAGE__->config->{substitutions} = { |
18 | foo => sub { shift; join( '-', @_ ); } |
19 | }; |
ffc0b0d8 |
20 | |
4b22d4c6 |
21 | __PACKAGE__->setup; |
22 | } |
ffc0b0d8 |
23 | |
663a4f34 |
24 | ok( my $conf = __PACKAGE__->config, 'config loads' ); |
ffc0b0d8 |
25 | is( $conf->{ 'Controller::Foo' }->{ foo }, 'bar' ); |
26 | is( $conf->{ 'Controller::Foo' }->{ new }, 'key' ); |
27 | is( $conf->{ 'Model::Baz' }->{ qux }, 'xyzzy' ); |
28 | is( $conf->{ 'Model::Baz' }->{ another }, 'new key' ); |
29 | is( $conf->{ 'view' }, 'View::TT::New' ); |
30 | is( $conf->{ 'foo_sub' }, 'x-y' ); |
663a4f34 |
31 | is( $conf->{ 'literal_macro' }, '__DATA__', 'literal macro' ); |
32 | is( $conf->{ 'environment_macro' }, $ENV{ CATALYST_HOME }.'/mockapp.pl', 'environment macro' ); |