diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-06-22 12:02:03 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-06-22 12:02:03 -0500 |
commit | 3669b3d498f2f6224b8dc8cdc8cfcca1c0165611 (patch) | |
tree | bc877d68dde1228eecd2978f6992d95ade4d4c71 /t/basic.t | |
parent | 51cc7663854af4760274c378c339e16a8eff65ab (diff) | |
download | plack-middleware-class-refresh-3669b3d498f2f6224b8dc8cdc8cfcca1c0165611.tar.gz plack-middleware-class-refresh-3669b3d498f2f6224b8dc8cdc8cfcca1c0165611.zip |
initial implementation
Diffstat (limited to 't/basic.t')
-rw-r--r-- | t/basic.t | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..2373218 --- /dev/null +++ b/t/basic.t @@ -0,0 +1,47 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Plack::Test; +use lib 't/lib'; +use Test::PMCR; + +use File::Copy; +use File::Spec::Functions 'catfile'; +use HTTP::Request::Common; + +use Plack::Middleware::Class::Refresh; + +my $dir = Test::PMCR::setup_temp_dir('basic'); + +require Foo; +require Foo::Bar; +require Baz::Quux; + +my $app = sub { + return [ + 200, + [], + [join "\n", Foo->call, Foo::Bar->call, Baz::Quux->call] + ]; +}; + +test_psgi + app => Plack::Middleware::Class::Refresh->wrap($app), + client => sub { + my $cb = shift; + { + my $res = $cb->(GET 'http://localhost/'); + is($res->code, 200, "right code"); + is($res->content, "Foo\nFoo::Bar\nBaz::Quux"); + } + copy(catfile(qw(t data_new basic Foo.pm)), catfile($dir, 'Foo.pm')) + || die "couldn't copy: $!"; + { + my $res = $cb->(GET 'http://localhost/'); + is($res->code, 200, "right code"); + is($res->content, "FOO\nFoo::Bar\nBaz::Quux"); + } + }; + +done_testing; |