Skip to content

Commit

Permalink
better command tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 30, 2012
1 parent 8606a7a commit 1def64d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 3 additions & 1 deletion t/mojolicious/app.t
Expand Up @@ -7,7 +7,7 @@ BEGIN {
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

use Test::More tests => 314;
use Test::More tests => 315;

use FindBin;
use lib "$FindBin::Bin/lib";
Expand Down Expand Up @@ -35,6 +35,8 @@ is ref $t->app->routes->find('something')->root, 'Mojolicious::Routes',
'right class';
is $t->app->sessions->cookie_domain, '.example.com', 'right domain';
is $t->app->sessions->cookie_path, '/bar', 'right path';
is $t->app->commands->get_data('some/static/file.txt', 'MojoliciousTest'),
"Production static file with low precedence.\n\n", 'right result';

# Plugin::Test::SomePlugin2::register (security violation)
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(500)
Expand Down
9 changes: 1 addition & 8 deletions t/mojolicious/commands.t
@@ -1,6 +1,6 @@
use Mojo::Base -strict;

use Test::More tests => 11;
use Test::More tests => 10;

use FindBin;
use lib "$FindBin::Bin/lib";
Expand Down Expand Up @@ -59,13 +59,6 @@ my $app;
$app = Mojolicious::Commands->start_app('MojoliciousTest');
}
is $app->start('test_command'), 'works!', 'right result';
$app = undef;
{
local $ENV{MOJO_APP_LOADER} = 1;
local $ENV{MOJO_APP} = 'MojoliciousTest';
$app = Mojolicious::Commands->start;
}
is $app->start('test_command'), 'works!', 'right result';
{
local $ENV{MOJO_APP};
is(Mojolicious::Commands->start_app(MojoliciousTest => 'test_command'),
Expand Down
4 changes: 3 additions & 1 deletion t/mojolicious/production_app.t
Expand Up @@ -7,7 +7,7 @@ BEGIN {
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

use Test::More tests => 79;
use Test::More tests => 80;

use FindBin;
use lib "$FindBin::Bin/lib";
Expand All @@ -30,6 +30,8 @@ is ref $t->app->routes->find('something')->root, 'Mojolicious::Routes',
'right class';
is $t->app->sessions->cookie_domain, '.example.com', 'right domain';
is $t->app->sessions->cookie_path, '/bar', 'right path';
is $t->app->commands->get_data('some/static/file.txt', 'MojoliciousTest'),
"Production static file with low precedence.\n\n", 'right result';

# Plugin::Test::SomePlugin2::register (security violation)
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(500)
Expand Down

0 comments on commit 1def64d

Please sign in to comment.