Created
August 24, 2020 18:54
-
-
Save davorg/327330680a1059bace31dde63bc560dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Test::More; | |
use Plack::Test; | |
use Plack::Util; | |
use HTTP::Request::Common; | |
my $app = Plack::Util::load_psgi './app.psgi'; | |
my $test = Plack::Test->create($app); | |
subtest main => sub { | |
my $res = $test->request(GET '/'); | |
is $res->status_line, '200 OK', 'Status'; | |
is $res->content, 'Hello World!', 'Content'; | |
}; | |
subtest not_found => sub { | |
my $res = $test->request(GET '/first'); | |
is $res->status_line, '404 Not Found', 'Status'; | |
like $res->content, qr{<title>Error 404 - Not Found</title>}; | |
like $res->content, qr{Powered by <a href="http://perldancer.org/">Dancer2</a>}; | |
}; | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment