X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fenv.t;h=0045f0172f588a2891738685eed35cfe24e8e886;hb=e4fd5ab63f9415fd211c44b2326489dc0d18a97b;hp=4cc0c4e0b68d5ad2e83f0bc08775083e68da23c7;hpb=c7b1c57f2dd693c14726456768339d40de9954ab;p=catagits%2FWeb-Simple.git diff --git a/t/env.t b/t/env.t index 4cc0c4e..0045f01 100644 --- a/t/env.t +++ b/t/env.t @@ -1,18 +1,15 @@ 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'; package EnvTest; - dispatch { + sub dispatch_request { sub (GET) { - my $env = @_[PSGI_ENV]; + my $env = $_[PSGI_ENV]; [ 200, [ "Content-type" => "text/plain" ], [ 'foo' ] @@ -21,16 +18,6 @@ use Test::More ( } } -use HTTP::Request::Common qw(GET POST); - 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; -} - -ok run_request(GET 'http://localhost/')->is_success; +ok $app->run_test_request(GET => 'http://localhost/')->is_success;