X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funit_core_component_loading.t;h=f0204ec2ebb3b7f015bc43c60e6094b622950cb1;hb=d4f67841aca20946ee3e6e32609a22d633d961e9;hp=a01edf0fcbb892564069682a8d5309925d3023cd;hpb=0756fe3bdd265109d7dcba43f1bef6430b9bfa02;p=catagits%2FCatalyst-Runtime.git diff --git a/t/unit_core_component_loading.t b/t/unit_core_component_loading.t index a01edf0..f0204ec 100644 --- a/t/unit_core_component_loading.t +++ b/t/unit_core_component_loading.t @@ -1,6 +1,7 @@ # 2 initial tests, and 6 per component in the loop below # (do not forget to update the number of components in test 3 as well) -use Test::More tests => 2 + 6 * 24; +# 4 extra tests for the loading options +use Test::More tests => 2 + 6 * 24 + 4; use strict; use warnings; @@ -119,3 +120,35 @@ foreach (keys %$complist) { } rmtree($libdir); + +# test extra component loading options + +$appclass = 'ExtraOptions'; +push @components, { type => 'View', prefix => 'Extra', name => 'Foo' }; + +foreach my $component (@components) { + make_component_file($component->{type}, + $component->{prefix}, + $component->{name}); +} + +eval qq( +package $appclass; +use Catalyst; +__PACKAGE__->config->{ setup_components } = { + search_extra => [ '::Extra' ], + except => [ "${appclass}::Controller::Foo" ] +}; +__PACKAGE__->setup; +); + +can_ok( $appclass, 'components'); + +$complist = $appclass->components; + +is(scalar keys %$complist, 24+1, "Correct number of components loaded"); + +ok( !exists $complist->{ "${appclass}::Controller::Foo" }, 'Controller::Foo was skipped' ); +ok( exists $complist->{ "${appclass}::Extra::Foo" }, 'Extra::Foo was loaded' ); + +rmtree($libdir); \ No newline at end of file