small sketch for custom container tests
[catagits/Catalyst-Runtime.git] / t / lib / TestCustomContainer.pm
CommitLineData
850a9bbe 1package TestCustomContainer;
2use Moose;
3use namespace::autoclean;
4use Test::More;
5
6has app_name => (
7 is => 'ro',
8 isa => 'Str',
9 default => 'TestAppCustomContainer',
10);
11
12has container_class => (
13 is => 'ro',
14 isa => 'Str',
15 lazy_build => 1,
16);
17
18has sugar => (
19 is => 'ro',
20 isa => 'Int',
21);
22
23sub BUILD {
24 my $self = shift;
25
26 $ENV{TEST_APP_CURRENT_CONTAINER} = $self->container_class;
27
28 require Catalyst::Test;
29 Catalyst::Test->import($self->app_name);
30
31 is(get('/container_class'), $self->container_class);
32 is(get('/container_isa'), $self->container_class);
33
34 done_testing;
35}
36
37sub _build_container_class {
38 my $self = shift;
39
40 my $sugar = $self->sugar ? '' : 'No';
41
42 return $self->app_name . "::${sugar}SugarContainer";
43}
44
45__PACKAGE__->meta->make_immutable;
46
471;