Release commit for 0.35
[catagits/Catalyst-Plugin-ConfigLoader.git] / t / 10-live_auto.t
1 use strict;
2 use warnings;
3
4 use FindBin;
5 use lib "$FindBin::Bin/lib";
6
7 use Test::More tests => 5;
8
9 BEGIN {
10     # Remove all relevant env variables to avoid accidental fail
11     foreach my $name ( grep { m{^(CATALYST)} } keys %ENV ) {
12         delete $ENV{ $name };
13     }
14 }
15
16 use Catalyst::Test 'TestApp';
17
18 {
19     my $response;
20     ok( $response = request( 'http://localhost/config/' ), 'request ok' );
21     is( $response->content, 'foo', 'config ok' );
22
23     $response = request( 'http://localhost/appconfig/cache' );
24     ok( $response->content !~ /^__HOME__/,
25         'home dir substituted in config var'
26     );
27
28     $response = request( 'http://localhost/appconfig/foo' );
29     is( $response->content, 'bar', 'app finalize_config works' );
30
31     $response = request( 'http://localhost/appconfig/multi' );
32     my $home = TestApp->config->{ home };
33     my $path = join( ',',
34         $home, TestApp->path_to( 'x' ),
35         $home, TestApp->path_to( 'y' ) );
36     is( $response->content, $path, 'vars substituted in config var, twice' );
37 }