Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 47 lines (38 sloc) 1.177 kb
0999324 @stash Support running Feersum under Plack.
authored
1 #!perl
2 use strict;
3 use Test::More;
4 use blib;
5 BEGIN {
6 $Plack::Test::Impl = 'Server';
7 $ENV{PLACK_SERVER} = 'Feersum';
8 $ENV{PLACK_DEV} = 'development';
9
10 plan skip_all => "Need Plack::Test to run this test"
11 unless eval "require Plack::Test; 1";
12 }
13
14 use Plack::Test::Server;
15 use Plack::Loader;
16
17 plan tests => 7;
18
19 is(Plack::Loader->guess(), 'Feersum', "guess feersum");
20
21 loader_load: {
22 my $svr = Plack::Loader->load('Feersum');
23 isa_ok $svr, 'Plack::Handler::Feersum', "explicit load";
24 }
25
26 loader_auto: {
27 my $svr = Plack::Loader->auto(host => 'ignored', port => '654321');
28 isa_ok $svr, 'Plack::Handler::Feersum', "auto-load";
29 }
30
31 Plack::Test::Server::test_psgi(
32 app => sub {
33 my $env = shift;
34 ok $env->{'psgix.body.scalar_refs'}, "seems to be Feersum";
35 is_deeply $env->{'psgi.version'}, [1,0], "is PSGI 1.0";
36 return [ 200, [ 'Content-Type' => 'text/plain' ], [ "Hello World" ] ],
37 },
38 client => sub {
39 my $cb = shift;
40 my $req = HTTP::Request->new(GET => "http://localhost/hello");
41 my $res = $cb->($req);
42 like $res->content, qr/Hello World/, "hello!";
43 }
44 );
45
46 pass 'done';
Something went wrong with that request. Please try again.