Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added redirection from / to /index, plus tests.

  • Loading branch information...
commit 3b56fde4f9be39fff1e3a02c26c12c9b3866c172 1 parent 029f35d
chromatic authored

Showing 2 changed files with 4 additions and 7 deletions. Show diff stats Hide diff stats

  1. +2 1  examples/Notes/lib/Notes.pm
  2. +2 6 examples/Notes/t/notes.t
3  examples/Notes/lib/Notes.pm
@@ -3,7 +3,8 @@ package Notes v1.0.0 {
3 3 use Dancer;
4 4 use Template;
5 5
6   - get '/' => \&show_index;
  6 + get '/' => sub { redirect '/index' };
  7 +
7 8 get '/index' => \&show_index;
8 9
9 10 get qr{/read/(.*?)/?} => sub
8 examples/Notes/t/notes.t
@@ -40,12 +40,8 @@ sub test_root
40 40 {
41 41 my $cb = shift;
42 42 my $res = $cb->( GET '/' );
43   -
44   - exit unless like $res->content, qr/<h1>Notes/, '/ should show index page';
45   - like $res->content, qr!/create">create new note</a>!,
46   - '... with link to create more notes';
47   -
48   - unlike $res->content, qr!/read/.+?">!, '... but no links to notes (yet)';
  43 + ok $res->is_redirect, '/ should redirect';
  44 + like $res->header( 'Location' ), qr!/index$!, '... to index';
49 45 }
50 46
51 47 sub test_index

0 comments on commit 3b56fde

Please sign in to comment.
Something went wrong with that request. Please try again.