Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 48 lines (39 sloc) 1.215 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';
dd1d1c1 @stash Set PLACK_ENV not PLACK_DEV, doh!
authored
8 $ENV{PLACK_ENV} = 'development';
0999324 @stash Support running Feersum under Plack.
authored
9
4fa49bd @stash Specify Plack >= 0.995 version for testing & recommending
authored
10 plan skip_all => "Need Plack >= 0.9950 to run this test"
11 unless eval 'require Plack; $Plack::VERSION >= 0.995';
0999324 @stash Support running Feersum under Plack.
authored
12 }
13
4fa49bd @stash Specify Plack >= 0.995 version for testing & recommending
authored
14 use Plack::Test;
0999324 @stash Support running Feersum under Plack.
authored
15 use Plack::Test::Server;
16 use Plack::Loader;
17
18 plan tests => 7;
19
20 is(Plack::Loader->guess(), 'Feersum', "guess feersum");
21
22 loader_load: {
23 my $svr = Plack::Loader->load('Feersum');
24 isa_ok $svr, 'Plack::Handler::Feersum', "explicit load";
25 }
26
27 loader_auto: {
28 my $svr = Plack::Loader->auto(host => 'ignored', port => '654321');
29 isa_ok $svr, 'Plack::Handler::Feersum', "auto-load";
30 }
31
32 Plack::Test::Server::test_psgi(
33 app => sub {
34 my $env = shift;
35 ok $env->{'psgix.body.scalar_refs'}, "seems to be Feersum";
e53918d @stash Specify psgi.run_once as per PSGI 1.1 spec.
authored
36 is_deeply $env->{'psgi.version'}, [1,1], "is PSGI 1.1";
0999324 @stash Support running Feersum under Plack.
authored
37 return [ 200, [ 'Content-Type' => 'text/plain' ], [ "Hello World" ] ],
38 },
39 client => sub {
40 my $cb = shift;
41 my $req = HTTP::Request->new(GET => "http://localhost/hello");
42 my $res = $cb->($req);
43 like $res->content, qr/Hello World/, "hello!";
44 }
45 );
46
47 pass 'done';
Something went wrong with that request. Please try again.