Mojolicious-Plugin-PlackMiddleware
view release on metacpan or search on metacpan
xt/compat/commands.t view on Meta::CPAN
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);
require Mojolicious::Commands;
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
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.257 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )