Commit | Line | Data |
4bb0a920 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More tests => 3; |
5 | use Test::Exception; |
6 | |
7 | use Moose (); |
8 | BEGIN { use_ok('CatalystX::DynamicComponent') } |
9 | |
10 | my $testapp_counter = 0; |
11 | sub generate_testapp { |
12 | my $role_options = shift || {}; |
13 | my $meta = Moose->init_meta( for_class => "TestApp" . $testapp_counter++ ); |
14 | $meta->superclasses('Catalyst'); |
15 | Moose::Util::apply_all_roles($meta, 'CatalystX::DynamicComponent', $role_options); |
16 | return $meta; |
17 | } |
18 | |
19 | throws_ok { generate_testapp(); } |
20 | qr/name\) is required/, 'name is required'; |
21 | |
22 | { |
23 | my $app_meta = generate_testapp({ name => 'dynamic_component_method' }); |
24 | my $app = $app_meta->name; |
25 | ok $app->can('dynamic_component_method'), 'dynamic component method added'; |
26 | |
27 | } |
28 | |