Skip to content

Commit

Permalink
fixed small caching bug in Mojolicious::Plugin::EPRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 18, 2012
1 parent b5c265d commit 6c3ed76
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.45 2012-01-18 00:00:00
- Fixed small caching bug in Mojolicious::Plugin::EPRenderer.

2.44 2012-01-18 00:00:00
- Added new not_found page for development mode.
- Added EXPERIMENTAL url_with helper to
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/EPRenderer.pm
Expand Up @@ -28,7 +28,7 @@ sub register {
my ($r, $c, $output, $options) = @_;

# Generate name
my $path = $r->template_path($options) || $options->{inline};
my $path = $options->{inline} || $r->template_path($options);
return unless defined $path;
my $id = encode 'UTF-8', join(', ', $path, sort keys %{$c->stash});
my $key = $options->{cache} = md5_sum $id;
Expand Down
17 changes: 16 additions & 1 deletion t/mojolicious/lite_app.t
Expand Up @@ -9,7 +9,7 @@ BEGIN {
$ENV{MOJO_MODE} = 'development';
}

use Test::More tests => 721;
use Test::More tests => 727;

# "Wait you're the only friend I have...
# You really want a robot for a friend?
Expand Down Expand Up @@ -539,6 +539,13 @@ get '/url_with/:foo' => sub {
$self->render(text => $self->url_with(foo => 'bar')->to_abs);
};

# GET /dynamic/inline
my $dynamic_inline = 1;
get '/dynamic/inline' => sub {
my $self = shift;
$self->render(inline => 'dynamic inline ' . $dynamic_inline++);
};

# Oh Fry, I love you more than the moon, and the stars,
# and the POETIC IMAGE NUMBER 137 NOT FOUND
my $t = Test::Mojo->new;
Expand Down Expand Up @@ -1405,6 +1412,14 @@ EOF
$t->get_ok('/url_with/foo?foo=bar')->status_is(200)
->content_like(qr|http\://localhost\:\d+/url_with/bar\?foo\=bar|);

# GET /dynamic/inline
$t->get_ok('/dynamic/inline')->status_is(200)
->content_is("dynamic inline 1\n");

# GET /dynamic/inline (again)
$t->get_ok('/dynamic/inline')->status_is(200)
->content_is("dynamic inline 2\n");

# User agent timer
$tua->ioloop->one_tick('0.1');
is $timer,
Expand Down

0 comments on commit 6c3ed76

Please sign in to comment.