Ver Fonte

beginning of some tests

George S. Baugh há 5 anos atrás
pai
commit
aff9e430ac
2 ficheiros alterados com 20 adições e 1 exclusões
  1. 17 0
      t/www-server.psgi.t
  2. 3 1
      www/server.psgi

+ 17 - 0
t/www-server.psgi.t

@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+
+use Test2::V0;
+use Test2::Tools::Explain;
+
+use FindBin;
+
+use Plack::Test;
+use HTTP::Request::Common;
+
+require "$FindBin::Bin/../www/server.psgi" or die 'Could not require server.psgi';
+
+my $test = Plack::Test->create($tcms::app);
+
+my $res = $test->request(HEAD "/");
+diag explain [$tcms::app],$res;

+ 3 - 1
www/server.psgi

@@ -1,3 +1,5 @@
+package tcms;
+
 use strict;
 use warnings;
 
@@ -64,7 +66,7 @@ If a path passed is not a defined route (or regex route), but exists as a file u
 
 =cut
 
-my $app = sub {
+our $app = sub {
     my $env = shift;
 
     #use Data::Dumper;