Debian Codegraph @

t/plugin_multiple_apps.t

raw
1 # plugin_multiple_apps.t
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use Plack::Test;
7 use HTTP::Request::Common;
8 use Ref::Util qw<is_coderef>;
9
10 {
11 package App;
12
13 BEGIN {
14 use Dancer2;
15 set session => 'Simple';
16 }
17
18 use lib '.';
19 use t::lib::SubApp1 with => { session => engine('session') };
20
21 use t::lib::SubApp2 with => { session => engine('session') };
22 }
23
24 my $app = Dancer2->psgi_app;
25 ok( is_coderef($app), 'Got app' );
26
27 test_psgi $app, sub {
28 my $cb = shift;
29
30 is( $cb->( GET '/subapp1' )->content, 1, '/subapp1' );
31 is( $cb->( GET '/subapp2' )->content, 2, '/subapp2' );
32 };
33
34 done_testing;