diff --git a/lib/PostText.pm b/lib/PostText.pm index c7415c3..c2a4ca7 100644 --- a/lib/PostText.pm +++ b/lib/PostText.pm @@ -43,6 +43,8 @@ sub startup($self) { my $r = $self->routes->under(sub ($c) { $c->session(expires => time + 31536000); + $c->session(author => 'Anonymous') unless $c->session('author'); + 1; }); diff --git a/t/post.t b/t/post.t index 3c9bf1b..1b12a6d 100644 --- a/t/post.t +++ b/t/post.t @@ -61,7 +61,7 @@ $t->post_ok('/post', form => \%invalid_title)->status_is(400) $t->post_ok('/post', form => \%invalid_post)->status_is(400) ->text_like(p => qr/Invalid text/); $t->post_ok('/post', form => \%valid_params)->status_is(200) - ->text_like(h2 => qr/Threads List/); + ->text_like(h2 => qr/Thread #[0-9]+/); $t->post_ok('/post/1')->status_is(200) ->element_exists('form input[name="author"]' ) diff --git a/templates/post.html.ep b/templates/post.html.ep index 56098f2..24e874a 100644 --- a/templates/post.html.ep +++ b/templates/post.html.ep @@ -4,11 +4,10 @@