Skip to content

Commit

Permalink
more logging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 31, 2013
1 parent d04f636 commit ba7830b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,4 +1,6 @@

4.30 2013-09-01

4.29 2013-08-31
- Fixed automatic rendering to work after non-blocking operations have been
performed in bridges.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -41,7 +41,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Top Hat';
our $VERSION = '4.29';
our $VERSION = '4.30';

sub AUTOLOAD {
my $self = shift;
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/group_lite_app.t
Expand Up @@ -192,12 +192,12 @@ $t->get_ok('/missing')->status_is(404)->content_is("Oops!\n");

# Suspended bridge
my $log = '';
my $cb = $t->ua->app->log->on(message => sub { $log .= pop });
my $cb = $t->app->log->on(message => sub { $log .= pop });
$t->get_ok('/suspended?ok=1')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('suspended!');
like $log, qr/Nothing has been rendered, expecting delayed response./,
'right message';
$t->ua->app->log->unsubscribe(message => $cb);
$t->app->log->unsubscribe(message => $cb);

# Suspended bridge (stopped)
$t->get_ok('/suspended?ok=0')->status_is(200)
Expand Down
5 changes: 5 additions & 0 deletions t/mojolicious/lite_app.t
Expand Up @@ -444,6 +444,11 @@ my $t = Test::Mojo->new;
is $t->app->test_helper2, 'Mojolicious::Controller', 'right class';
is $t->app, app->commands->app, 'applications are equal';
is $t->app->moniker, 'lite_app', 'right moniker';
my $log = '';
my $cb = $t->app->log->on(message => sub { $log .= pop });
is $t->app->secret, $t->app->moniker, 'secret defaults to moniker';
like $log, qr/Your secret passphrase needs to be changed!!!/, 'right message';
$t->app->log->unsubscribe(message => $cb);

# Unicode snowman
$t->get_ok('/☃')->status_is(200)
Expand Down
6 changes: 4 additions & 2 deletions t/mojolicious/longpolling_lite_app.t
Expand Up @@ -347,16 +347,18 @@ is $longpoll_nolength_delayed, 'finished!', 'finished';

# Delayed static file (with log message)
my $log = '';
my $cb = $t->ua->app->log->on(message => sub { $log .= pop });
my $cb = $t->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';
$t->app->log->unsubscribe(message => $cb);

# Delayed static file with cookies and session (without log message)
$log = '';
$cb = $t->app->log->on(message => sub { $log .= pop });
$t->get_ok('/longpoll/static/delayed_too')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->header_like('Set-Cookie' => qr/bar=baz/)
Expand All @@ -366,7 +368,7 @@ $t->get_ok('/longpoll/static/delayed_too')->status_is(200)
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);
$t->app->log->unsubscribe(message => $cb);

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

0 comments on commit ba7830b

Please sign in to comment.