File: external_app.t

package info (click to toggle)
libmojolicious-perl 9.31%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,260 kB
  • sloc: perl: 10,139; makefile: 31; javascript: 1
file content (48 lines) | stat: -rw-r--r-- 1,201 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use Mojo::Base -strict;

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

use Test::More;

use Mojo::File qw(curfile);
use lib curfile->sibling('external', 'lib')->to_string;

use Test::Mojo;

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

subtest 'Text from config file' => sub {
  $t->get_ok('/')->status_is(200)->content_is('too%21');
};

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

subtest 'More text from config file' => sub {
  $t->get_ok('/test')->status_is(200)->content_is('works%21');
};

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

subtest 'Text from config override' => sub {
  $t->get_ok('/')->status_is(200)->content_is('override two!');
};

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

subtest 'More text from config override' => sub {
  $t->get_ok('/test')->status_is(200)->content_is('override!');
};

subtest 'Config stash value from template' => sub {
  $t->get_ok('/inline')->status_is(200)->content_is('override!');
};

done_testing();