Skip to content

Commit

Permalink
Further tests for auto_page feature.
Browse files Browse the repository at this point in the history
Test that views in subdirs are served appropriately, and that directory indexes
(e.g. requesting /foo/ gets views/foo/index.tt) work.
  • Loading branch information
bigpresh committed Feb 16, 2012
1 parent 46c3ca4 commit 16a9a9a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ t/03_route_handler/public/404.html
t/03_route_handler/public/utf8file.txt
t/03_route_handler/views/error.tt
t/03_route_handler/views/hello.tt
t/03_route_handler/views/foo/index.tt
t/03_route_handler/views/foo/bar.tt
t/04_static_file/001_base.t
t/04_static_file/003_mime_types_reinit.t
t/04_static_file/01_mime_types.t
Expand Down
8 changes: 7 additions & 1 deletion t/03_route_handler/18_auto_page.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# takes care of rendering it.
use strict;
use warnings;
use Test::More import => ['!pass'], tests => 4;
use Test::More import => ['!pass'], tests => 8;
use Dancer::Test;

{
Expand All @@ -23,5 +23,11 @@ use Dancer::Test;
response_status_is [GET => '/hello'] => 200, "response found for /hello";
response_content_is [GET => '/hello'] => "Hello\n", "content looks good";

response_status_is [GET => '/foo/bar' ], 200, "response found for /foo/bar";
response_content_is [GET => '/foo/bar' ], "foo/bar\n", "content looks good";

response_status_is [GET => '/foo/' ], 200, "response found for /foo/";
response_content_is [GET => '/foo/' ], "foo/index\n", "content looks good";

response_status_is [GET => '/falsepage'] => 404;
response_content_like [GET => '/error'] => qr/ERROR: Dancer\n/, "error page looks OK";
1 change: 1 addition & 0 deletions t/03_route_handler/views/foo/bar.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo/bar
1 change: 1 addition & 0 deletions t/03_route_handler/views/foo/index.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo/index

0 comments on commit 16a9a9a

Please sign in to comment.