Browse files

Added redirection from / to /index, plus tests.

  • Loading branch information...
1 parent 029f35d commit 3b56fde4f9be39fff1e3a02c26c12c9b3866c172 @chromatic committed Sep 19, 2011
Showing with 4 additions and 7 deletions.
  1. +2 −1 examples/Notes/lib/Notes.pm
  2. +2 −6 examples/Notes/t/notes.t
View
3 examples/Notes/lib/Notes.pm
@@ -3,7 +3,8 @@ package Notes v1.0.0 {
use Dancer;
use Template;
- get '/' => \&show_index;
+ get '/' => sub { redirect '/index' };
+
get '/index' => \&show_index;
get qr{/read/(.*?)/?} => sub
View
8 examples/Notes/t/notes.t
@@ -40,12 +40,8 @@ sub test_root
{
my $cb = shift;
my $res = $cb->( GET '/' );
-
- exit unless like $res->content, qr/<h1>Notes/, '/ should show index page';
- like $res->content, qr!/create">create new note</a>!,
- '... with link to create more notes';
-
- unlike $res->content, qr!/read/.+?">!, '... but no links to notes (yet)';
+ ok $res->is_redirect, '/ should redirect';
+ like $res->header( 'Location' ), qr!/index$!, '... to index';
}
sub test_index

0 comments on commit 3b56fde

Please sign in to comment.