File: external_app.t

package info (click to toggle)
libmojolicious-perl 8.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,720 kB
  • sloc: perl: 12,099; makefile: 14
file content (44 lines) | stat: -rw-r--r-- 1,023 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Mojo::Base -strict;

BEGIN {
  $ENV{MOJO_MODE}    = 'testing';
  $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

use Test::More;

use FindBin;
use lib "$FindBin::Bin/external/lib";

use Test::Mojo;

my $t = Test::Mojo->new('MyApp');

# Text from config file
$t->get_ok('/')->status_is(200)->content_is('too%21');

# Static file
$t->get_ok('/index.html')->status_is(200)
  ->content_is("External static file!\n");

# More text from config file
$t->get_ok('/test')->status_is(200)->content_is('works%21');

# Config override
$t = Test::Mojo->new(
  MyApp => {whatever => 'override!', works => 'override two!'});

# Text from config override
$t->get_ok('/')->status_is(200)->content_is('override two!');

# Static file again
$t->get_ok('/index.html')->status_is(200)
  ->content_is("External static file!\n");

# More text from config override
$t->get_ok('/test')->status_is(200)->content_is('override!');

# Config stash value from template
$t->get_ok('/inline')->status_is(200)->content_is('override!');

done_testing();