Skip to content

Commit

Permalink
use the correct term in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 27, 2013
1 parent d279cfb commit 658c6cb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/Mojolicious/Routes.pm
Expand Up @@ -216,7 +216,7 @@ sub _next {
# Next
return $self->_next($c, $stack) unless ref $continue eq 'SCALAR';

# Delay
# Suspend
$c->render_later;
$$continue = sub { $self->_next($c, $stack) };
return 1;
Expand Down
8 changes: 4 additions & 4 deletions t/mojolicious/app.t
Expand Up @@ -453,10 +453,10 @@ $t->get_ok('/staged' => {'X-Pass' => 1})->status_is(200)
$t->get_ok('/staged')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('Go away!');

# MojoliciousTestController::Foo::delayed
$t->get_ok('/delayed')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Delayed' => '1, 1')->content_is('Have fun!');
# MojoliciousTestController::Foo::suspended
$t->get_ok('/suspended')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Suspended' => '1, 1')->content_is('Have fun!');

# MojoliciousTest::Foo::config
$t->get_ok('/stash_config')->status_is(200)
Expand Down
16 changes: 8 additions & 8 deletions t/mojolicious/group_lite_app.t
Expand Up @@ -22,22 +22,22 @@ get '/expiration' => sub {

under('/missing' => sub {1})->route->to('does_not_exist#not_at_all');

under '/delayed' => sub {
under '/suspended' => sub {
my $self = shift;

my $continue;
Mojo::IOLoop->timer(
0 => sub {
return $self->render(text => 'stopped!') unless $self->param('ok');
$self->stash(delayed => 'delayed!');
$self->stash(suspended => 'suspended!');
$continue->();
}
);

return \$continue;
};

get '/' => sub { shift->render(inline => '<%= $delayed %>\\') };
get '/' => sub { shift->render(inline => '<%= $suspended %>\\') };

under sub {
my $self = shift;
Expand Down Expand Up @@ -206,12 +206,12 @@ $t->reset_session;
# Missing action behind bridge
$t->get_ok('/missing')->status_is(404);

# Delayed bridge
$t->get_ok('/delayed?ok=1')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('delayed!');
# Suspended bridge
$t->get_ok('/suspended?ok=1')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('suspended!');

# Delayed bridge (stopped)
$t->get_ok('/delayed?ok=0')->status_is(200)
# Suspended bridge (stopped)
$t->get_ok('/suspended?ok=0')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('stopped!');

# Authenticated with header
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/lib/MojoliciousTest.pm
Expand Up @@ -144,8 +144,8 @@ sub startup {
my $b = $r->bridge('/staged')->to('foo#stage1', return => 1);
$b->route->to(action => 'stage2');

# /delayed (delayed bridge)
$r->bridge('/delayed')->to('foo#delayed')->bridge->to('foo#delayed')
# /suspended (suspended bridge)
$r->bridge('/suspended')->to('foo#suspended')->bridge->to('foo#suspended')
->route->to('foo#fun');

# /shortcut/act
Expand Down
28 changes: 14 additions & 14 deletions t/mojolicious/lib/MojoliciousTest/Foo.pm
Expand Up @@ -11,20 +11,6 @@ sub config {
$self->render(text => $self->stash('config')->{test});
}

sub delayed {
my $self = shift;

my $continue;
Mojo::IOLoop->timer(
0 => sub {
$self->res->headers->append('X-Delayed' => 1);
$continue->();
}
);

return \$continue;
}

sub fun { shift->render(text => 'Have fun!') }

sub index {
Expand Down Expand Up @@ -68,6 +54,20 @@ sub stage1 {

sub stage2 { return shift->some_plugin }

sub suspended {
my $self = shift;

my $continue;
Mojo::IOLoop->timer(
0 => sub {
$self->res->headers->append('X-Suspended' => 1);
$continue->();
}
);

return \$continue;
}

sub syntaxerror { shift->render('syntaxerror', format => 'html') }

sub templateless { shift->render(handler => 'test') }
Expand Down

0 comments on commit 658c6cb

Please sign in to comment.