t/app_alone.t
raw| 1 | #!perl |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| 6 | use Test::More tests => 3; |
| 7 | use Plack::Test; |
| 8 | use HTTP::Request::Common; |
| 9 | |
| 10 | { |
| 11 | package MyApp; |
| 12 | use Dancer2; |
| 13 | |
| 14 | get '/' => sub {'OK'}; |
| 15 | } |
| 16 | |
| 17 | my $app = MyApp->to_app; |
| 18 | isa_ok( $app, 'CODE' ); |
| 19 | |
| 20 | test_psgi $app, sub { |
| 21 | my $cb = shift; |
| 22 | is( $cb->( GET '/' )->code, 200, '[GET /] Correct status' ); |
| 23 | is( $cb->( GET '/' )->content, 'OK', '[GET /] Correct content' ); |
| 24 | }; |
| 25 |