File: 09_load_app.t

package info (click to toggle)
libdancer-perl 1.3202%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,408 kB
  • ctags: 638
  • sloc: perl: 7,215; xml: 1,977; sh: 51; makefile: 29; sql: 5
file content (23 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use Test::More tests => 5, import => ['!pass'];
use strict;
use warnings;

use Dancer ':syntax';

# XXX appdir is set to the path of the current test
use Dancer::Test appdir => path($0);

eval { load_app 'UnexistentApp' };
like $@, qr/unable to load application UnexistentApp : Can't locate/, 
    'load_app fails if the app is not found';

eval { load_app 'AppWithError' };
like $@, qr/unable to load application AppWithError : Bareword/, 
    'load_app fails if the app has syntax errors';

eval { load_app 'WorkingApp' };
is $@, '', "WorkingApp loaded";

route_exists [ GET => '/app'];
response_content_is [ GET => '/app'], "app";