eliminate HTTP::Request::AsCGI in favour of Plack::Test
[catagits/Web-Simple.git] / t / env.t
diff --git a/t/env.t b/t/env.t
index d566671..47bde37 100644 (file)
--- a/t/env.t
+++ b/t/env.t
@@ -1,11 +1,8 @@
 use strict;
 use warnings FATAL => 'all';
 
-use Test::More (
-  eval { require HTTP::Request::AsCGI }
-    ? 'no_plan'
-    : (skip_all => 'No HTTP::Request::AsCGI')
-);
+use Test::More 'no_plan';
+use Plack::Test;
 
 {
   use Web::Simple 'EnvTest';
@@ -27,10 +24,7 @@ my $app = EnvTest->new;
 
 sub run_request {
   my $request = shift;
-  my $c = HTTP::Request::AsCGI->new($request)->setup;
-  $app->run;
-  $c->restore;
-  return $c->response;
+  return test_psgi $app->to_psgi_app, sub { shift->($request) };
 }
 
 ok run_request(GET 'http://localhost/')->is_success;