t/template_name.t
raw| 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use Plack::Test; |
| 5 | use HTTP::Request::Common; |
| 6 | use Ref::Util qw<is_coderef>; |
| 7 | |
| 8 | { |
| 9 | |
| 10 | package Foo; |
| 11 | |
| 12 | use Dancer2; |
| 13 | |
| 14 | get '/template_name' => sub { |
| 15 | return engine('template')->name; |
| 16 | }; |
| 17 | } |
| 18 | |
| 19 | my $app = Foo->to_app; |
| 20 | ok( is_coderef($app), 'Got app' ); |
| 21 | |
| 22 | test_psgi $app, sub { |
| 23 | my $cb = shift; |
| 24 | is( $cb->( GET '/template_name' )->content, 'Tiny', 'template name' ); |
| 25 | }; |
| 26 | |
| 27 | done_testing; |