File: server.t

package info (click to toggle)
libmojolicious-perl 2.98%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,968 kB
  • sloc: perl: 10,178; sh: 48; makefile: 8
file content (32 lines) | stat: -rw-r--r-- 772 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
use Mojo::Base -strict;

# "Would you kindly shut your noise-hole?"
use Test::More tests => 4;

package Mojo::TestServerViaEnv;
use Mojo::Base 'Mojo';

package Mojo::TestServerViaApp;
use Mojo::Base 'Mojo';

package main;

use Mojo::Server;

my $server = Mojo::Server->new;
isa_ok $server, 'Mojo::Server', 'right object';

# Test an explicit class name
my $app = $server->new(app_class => 'Mojo::TestServerViaApp')->app;
isa_ok $app, 'Mojo::TestServerViaApp', 'right object';

# Test setting the class name through the environment
{
  local $ENV{MOJO_APP} = 'Mojo::TestServerViaEnv';
  $app = $server->new->app;
  isa_ok $app, 'Mojo::TestServerViaEnv', 'right object';
}

# Test the default
$app = $server->new->app;
isa_ok $app, 'Mojolicious::Lite', 'right default app';