File: live_component_controller_actionroles.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 862 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use warnings;
use Test::More;

use FindBin;
use lib "$FindBin::Bin/../lib";

use Catalyst::Test 'TestApp';

my %roles = (
    foo  => 'TestApp::ActionRole::Guff',
    bar  => 'TestApp::ActionRole::Guff',
    baz  => 'Guff',
    quux => 'Catalyst::ActionRole::Zoo',
);

while (my ($path, $role) = each %roles) {
    my $resp = request("/actionroles/${path}");
    ok($resp->is_success);
    is($resp->content, $role);
    is($resp->header('X-Affe'), 'Tiger');
}

{
    my $resp = request("/actionroles/corge");
    ok($resp->is_success);
    is($resp->content, 'TestApp::ActionRole::Guff');
    is($resp->header('X-Affe'), 'Tiger');
    is($resp->header('X-Action-After'), 'moo');
}
{
    my $resp = request("/actionroles/frew");
    ok($resp->is_success);
    is($resp->content, 'hello', 'action_args are honored with ActionRoles');
 }
done_testing;