Debian Codegraph @

t/issues/gh-1230/lib/Dancer2/Plugin/Test/AccessPluginDSL.pm

raw
1 package Dancer2::Plugin::Test::AccessPluginDSL;
2 use strict;
3 use warnings;
4 use Dancer2::Plugin;
5 use Dancer2::Plugin::Test::AccessDSL;
6
7 plugin_keywords('test_change_response_status');
8
9 sub test_change_response_status {
10 my $self = shift;
11 my $caller = caller(1);
12 ::is( $self->app->name, 'OtherApp', 'Appname is OtherApp' );
13 ::is( $caller, 'App::Extra', 'The caller class is App::Extra' );
14
15 ::ok(
16 ::exception( sub { App::Extra::change_response_status() } ),
17 'App does not receive DSL from our inner Plugin',
18 );
19
20 ::is(
21 ::exception( sub { change_response_status() } ),
22 undef,
23 'Successfully called the plugin DSL (via plugin->dsl)',
24 );
25
26 ::is(
27 $self->app->response->status(),
28 200,
29 'Status was set correctly',
30 );
31 }
32
33 1;