Skip to content

Commit

Permalink
add some tests for PerlDancer#113
Browse files Browse the repository at this point in the history
  • Loading branch information
fcuny committed Sep 2, 2010
1 parent 9d250e6 commit f20148a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
11 changes: 10 additions & 1 deletion t/03_route_handler/15_prefix.t
@@ -1,7 +1,7 @@
use Test::More import => ['!pass'];
use t::lib::TestUtils;

plan tests => 23;
plan tests => 26;

use Dancer ':syntax';
use Dancer::Test;
Expand Down Expand Up @@ -53,6 +53,14 @@ ok(
'route /:word defined'
);

ok(
get(
'/' => sub {
"char: all";
}
),
'route / defined'
);

ok( prefix(undef), "undef prefix" );

Expand All @@ -66,6 +74,7 @@ ok(
);

my @tests = (
{ path => '/say/', expected => 'char: all' },
{ path => '/say/A', expected => 'char: A' },
{ path => '/say/24', expected => 'number: 24' },
{ path => '/say/B', expected => 'char: B' },
Expand Down
14 changes: 10 additions & 4 deletions t/17_apps/03_prefix.t
@@ -1,4 +1,4 @@
use Test::More tests => 3, import => ['!pass'];
use Test::More tests => 5, import => ['!pass'];
use strict;
use warnings;

Expand All @@ -7,6 +7,10 @@ use Dancer::Test;

prefix '/foo';

get '/' => sub {
'/foo and /foo/'
};

get '/bar' => sub {
"/foo/bar"
};
Expand All @@ -17,6 +21,8 @@ get '/baz' => sub {
"/baz"
};

response_content_is [GET => "/foo/bar"], "/foo/bar";
response_doesnt_exist [GET => '/foo/baz'];
response_content_is [GET => "/baz"], "/baz";
response_content_is [ GET => "/foo/bar" ], "/foo/bar";
response_content_is [ GET => "/foo/" ], "/foo and /foo/";
response_content_is [ GET => "/foo" ], "/foo and /foo/";
response_doesnt_exist [ GET => '/foo/baz' ];
response_content_is [ GET => "/baz" ], "/baz";

0 comments on commit f20148a

Please sign in to comment.