Mojolicious-Plugin-PlackMiddleware

 view release on metacpan or  search on metacpan

xt/compat/commands.t  view on Meta::CPAN

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use FindBin;
use lib "$FindBin::Bin/lib";
 
use Cwd 'cwd';
use File::Temp 'tempdir';
 
# Make sure @ARGV is not changed
{
  local $ENV{MOJO_MODE};
  local @ARGV = qw(-m production -x whatever);
  is $ENV{MOJO_MODE}, 'production', 'right mode';
  is_deeply \@ARGV, [qw(-m production -x whatever)], 'unchanged';
}
 
# Environment detection
my $commands = Mojolicious::Commands->new;
{
  local $ENV{PLACK_ENV} = 'production';
  is $commands->detect, 'psgi', 'right environment';

xt/compat/commands.t  view on Meta::CPAN

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
is $app->start('test_command'), 'works!', 'right result';
{
  is(Mojolicious::Commands->start_app(MojoliciousTest => 'test_command'),
    'works!', 'right result');
}
 
# Do not pick up options for detected environments
{
  local $ENV{MOJO_MODE};
  local $ENV{PLACK_ENV} = 'testing';
  local @ARGV = qw(psgi -m production);
  is ref Mojolicious::Commands->start_app('MojoliciousTest'), 'CODE',
    'right reference';
  is $ENV{MOJO_MODE}, undef, 'no mode';
}
 
# mojo
is_deeply $commands->namespaces, ['Mojolicious::Command'], 'right namespaces';
ok $commands->description, 'has a description';
like $commands->message,   qr/COMMAND/, 'has a message';
like $commands->hint,      qr/help/, 'has a hint';



( run in 0.361 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )