Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (30 sloc) 1.027 kb
use lib "lib";
use Plack::Test;
use Plack::Util;
use HTTP::Request::Common;
use Test::More;
$ENV{PLACK_ENV} = 'development';
my $app = Plack::Util::load_psgi($ARGV[0]);
test_psgi $app, sub {
my $cb = shift;
my $res = $cb->(GET "/");
is $res->content_type, 'text/plain';
like $res->content, qr/Hello World/;
$res = $cb->(GET "/blog/2010/02");
is $res->content_type, 'text/html';
like $res->content, qr/Blog posts from 2010\/02/;
$res = $cb->(POST "/blog/2009/01");
ok $res->is_error;
$res = $cb->(POST "/comment", { name => "miyagawa", body => "Awesome blog!" });
like $res->content, qr/body=Awesome blog!/;
$res = $cb->(GET "/nonexistent");
is $res->code, 404;
local $TODO = "Nice to have";
$res = $cb->(POST "/blog/2009/01");
is $res->code, 405, '405 on POST requests against GET only endpoints';
$res = $cb->(GET "/blog/now/today");
is $res->code, 404, 'year & month can specify digits';
Jump to Line
Something went wrong with that request. Please try again.