1use Test::More tests => 12, import => ['!pass'];
2use strict;
3use warnings;
4
5use Dancer::Test;
6use File::Spec;
7use lib File::Spec->catdir( 't', 'lib' );
8
9{
10    use Dancer;
11
12    load_app 'TestApp';
13    load_app 'Forum', prefix => '/forum';
14
15    get '/' => sub { "home" };
16}
17
18my $apps = [ Dancer::App->applications ];
19is scalar(@$apps), 3, "3 applications exist";
20
21for (
22    { name => "main",    routes => 1  },
23    { name => "TestApp", routes => 20 },
24    { name => "Forum",   routes => 5  },
25)
26{
27    my $app = Dancer::App->get($_->{name});
28    ok(
29        defined($app)
30        , "app $_->{name} is defined",
31    );
32    is(
33        @{ $app->registry->routes('get') },
34        $_->{routes},
35        "Expected number of get routes defined for " . $_->{name},
36    );
37}
38
39response_content_is [GET => "/forum/index"], "forum index";
40response_content_is [GET => "/forum/admin/index"], "admin index";
41response_content_is [GET => "/forum/users/list"], "users list";
42response_content_is [GET => "/forum/users/mods/list"], "mods list";
43response_content_is [GET => "/forum/"], "root";
44