From: André Walker Date: Thu, 11 Aug 2011 17:38:45 +0000 (-0300) Subject: sane names for models X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=04189a0f6c54fc880f1688dc28785016671f5d34;hp=ea33d4610002b98eb830bbc250feb812813c926b;p=catagits%2FCatalyst-Runtime.git sane names for models --- diff --git a/t/lib/TestAppCustomContainer/Model/Bar.pm b/t/lib/TestAppCustomContainer/Model/SingletonLifeCycle.pm similarity index 76% rename from t/lib/TestAppCustomContainer/Model/Bar.pm rename to t/lib/TestAppCustomContainer/Model/SingletonLifeCycle.pm index 86dcfd2..4a6822e 100644 --- a/t/lib/TestAppCustomContainer/Model/Bar.pm +++ b/t/lib/TestAppCustomContainer/Model/SingletonLifeCycle.pm @@ -1,4 +1,4 @@ -package TestAppCustomContainer::Model::Bar; +package TestAppCustomContainer::Model::SingletonLifeCycle; use Moose; extends 'Catalyst::Model'; with 'TestAppCustomContainer::Role::HoldsFoo', diff --git a/t/lib/TestAppCustomContainer/NoSugarContainer.pm b/t/lib/TestAppCustomContainer/NoSugarContainer.pm index 09e99dc..10f50fd 100644 --- a/t/lib/TestAppCustomContainer/NoSugarContainer.pm +++ b/t/lib/TestAppCustomContainer/NoSugarContainer.pm @@ -11,10 +11,10 @@ sub BUILD { warn("Add Bar to model"); $self->get_sub_container('model')->add_service( Catalyst::IOC::ConstructorInjection->new( - name => 'Bar', + name => 'SingletonLifeCycle', lifecycle => 'Singleton', - class => 'TestAppCustomContainer::Model::Bar', - catalyst_component_name => 'TestAppCustomContainer::Model::Bar', + class => 'TestAppCustomContainer::Model::SingletonLifeCycle', + catalyst_component_name => 'TestAppCustomContainer::Model::SingletonLifeCycle', dependencies => { application_name => depends_on( '/application_name' ), foo => depends_on('/model/DefaultSetup'), diff --git a/t/lib/TestCustomContainer.pm b/t/lib/TestCustomContainer.pm index 5231b89..2bcbdfe 100644 --- a/t/lib/TestCustomContainer.pm +++ b/t/lib/TestCustomContainer.pm @@ -42,7 +42,7 @@ sub BUILD { is(get('/container_isa'), $self->container_class, 'and container isa our container class'); { - # Foo ACCEPT_CONTEXT called - total: 1 + # DefaultSetup ACCEPT_CONTEXT called - total: 1 ok(my ($res, $c) = ctx_request('/get_model_baz'), 'request'); ok($res->is_success, 'request 2xx'); is($res->content, 'TestAppCustomContainer::Model::Baz', 'content is expected'); @@ -56,14 +56,14 @@ sub BUILD { # isa_ok($foo, 'TestAppCustomContainer::Model::Foo'); # is($foo->baz_got_it, 1, 'Baz accessed Foo once'); - # Foo ACCEPT_CONTEXT called - total: 2 + # DefaultSetup ACCEPT_CONTEXT called - total: 2 ok(get('/get_model_baz'), 'another request'); is($baz->accept_context_called, 1, 'ACCEPT_CONTEXT not called again (instance per context)'); # is($foo->baz_got_it, 2, 'Baz accessed Foo again'); } { - # Foo ACCEPT_CONTEXT called - total: 3 + # DefaultSetup ACCEPT_CONTEXT called - total: 3 ok(my ($res, $c) = ctx_request('/get_model_bar'), 'request'); ok($res->is_success, 'request 2xx'); is($res->content, 'TestAppCustomContainer::Model::Bar', 'content is expected'); @@ -79,14 +79,14 @@ sub BUILD { # isa_ok($foo, 'TestAppCustomContainer::Model::Foo'); # is($foo->bar_got_it, 1, 'Bar accessed Foo once'); - # Foo ACCEPT_CONTEXT *not* called - total: 3 + # DefaultSetup ACCEPT_CONTEXT *not* called - total: 3 ok(get('/get_model_bar'), 'another request'); is($bar->accept_context_called, 1, 'ACCEPT_CONTEXT not called again (lifecycle is Singleton)'); # is($foo->bar_got_it, 1, 'Bar didn\'t access Foo again'); } { - # Foo ACCEPT_CONTEXT called - total: 4 + # DefaultSetup ACCEPT_CONTEXT called - total: 4 ok(my ($res, $c) = ctx_request('/get_model_foo'), 'request'); ok($res->is_success, 'request 2xx'); is($res->content, 'TestAppCustomContainer::Model::Foo', 'content is expected');