Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more tests for delayed rendering
  • Loading branch information
kraih committed Aug 29, 2013
1 parent 65c2e51 commit c97acb8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions t/mojolicious/longpolling_lite_app.t
Expand Up @@ -345,20 +345,28 @@ $t->get_ok('/longpoll/nolength/delayed')->status_is(200)
->content_is('howdy nolength!');
is $longpoll_nolength_delayed, 'finished!', 'finished';

# Delayed static file
# Delayed static file (with log message)
my $log = '';
my $cb = $t->ua->app->log->on(message => sub { $log .= pop });
$t->get_ok('/longpoll/static/delayed')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_type_is('text/plain')
->content_is("Hello Mojo from a static file!\n");
is $longpoll_static_delayed, 'finished!', 'finished';
like $log, qr/Nothing has been rendered, expecting delayed response./,
'right message';

# Delayed static file with cookies and session
# Delayed static file with cookies and session (without log message)
$log = '';
$t->get_ok('/longpoll/static/delayed_too')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->header_like('Set-Cookie' => qr/bar=baz/)
->header_like('Set-Cookie' => qr/mojolicious=/)
->content_type_is('text/plain')
->content_is("Hello Mojo from a static file!\n");
is $longpoll_static_delayed_too, 'finished!', 'finished';
unlike $log, qr/Nothing has been rendered, expecting delayed response./,
'right message';
$t->ua->app->log->unsubscribe(message => $cb);

# Delayed custom response
$t->get_ok('/longpoll/dynamic/delayed')->status_is(201)
Expand Down

0 comments on commit c97acb8

Please sign in to comment.