File: catalyst-request-rest-custom-nonrest-request-class.t

package info (click to toggle)
libcatalyst-action-rest-perl 1.21-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 476 kB
  • sloc: perl: 1,750; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 703 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
use strict;
use warnings;
use Test::More;
use FindBin;
use Moose ();
use lib ( "$FindBin::Bin/lib" );

my $test = 'Test::Catalyst::Action::REST';

my $meta = Moose::Meta::Class->create_anon_class(
    superclasses => ['Catalyst::Request'],
);
$meta->add_method('__random_method' => sub { 42 });

$ENV{CAR_TEST_REQUEST_CLASS} = $meta->name;

use_ok $test;
ok($test->request_class->does('Catalyst::TraitFor::Request::REST'),
  'Request class does Catalyst::TraitFor::Request::REST');
isnt $test->request_class, $meta->name, 'Different request class';
ok $test->request_class->can('__random_method'), 'Is right class';
ok $test->request_class->can('data'), 'Also smells like REST subclass';

done_testing;